Changeset 14:1a4f21f35b65

Renamed adapters to adapter
author unexist
date Sat, 10 Apr 2021 15:59:33 +0200
parents b7e4945bc5b3
children 8a4e615eabed
files src/main/java/dev/unexist/showcase/todo/adapter/TodoConsumer.java src/main/java/dev/unexist/showcase/todo/adapter/TodoProducer.java src/main/java/dev/unexist/showcase/todo/adapter/TodoResource.java src/main/java/dev/unexist/showcase/todo/adapters/TodoConsumer.java src/main/java/dev/unexist/showcase/todo/adapters/TodoProducer.java src/main/java/dev/unexist/showcase/todo/adapters/TodoResource.java
diffstat 6 files changed, 148 insertions(+), 148 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/dev/unexist/showcase/todo/adapter/TodoConsumer.java	Sat Apr 10 15:59:33 2021 +0200
@@ -0,0 +1,41 @@
+/**
+ * @package Quarkus-Pipes-Filters-Showcase
+ *
+ * @file Todo consumer
+ * @copyright 2020 Christoph Kappel <christoph@unexist.dev>
+ * @version $Id$
+ *
+ * This program can be distributed under the terms of the GNU GPLv3.
+ * See the file LICENSE for details.
+ **/
+
+package dev.unexist.showcase.todo.adapter;
+
+import dev.unexist.showcase.todo.domain.todo.TodoDto;
+import dev.unexist.showcase.todo.domain.todo.events.TodoCreated;
+import org.eclipse.microprofile.reactive.messaging.Acknowledgment;
+import org.eclipse.microprofile.reactive.messaging.Incoming;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class TodoConsumer {
+    private static final Logger LOGGER = LoggerFactory.getLogger(TodoConsumer.class);
+
+    @Inject
+    Event<TodoCreated> event;
+
+    @Incoming("todo-in")
+    @Acknowledgment(Acknowledgment.Strategy.PRE_PROCESSING)
+    public void receive(TodoDto dto) {
+        if (null != dto) {
+            this.event.fire(new TodoCreated(dto));
+
+            LOGGER.info("Sent event={}", TodoCreated.class.getSimpleName());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/dev/unexist/showcase/todo/adapter/TodoProducer.java	Sat Apr 10 15:59:33 2021 +0200
@@ -0,0 +1,50 @@
+/**
+ * @package Quarkus-Pipes-Filters-Showcase
+ *
+ * @file Todo producer
+ * @copyright 2020 Christoph Kappel <christoph@unexist.dev>
+ * @version $Id$
+ *
+ * This program can be distributed under the terms of the GNU GPLv3.
+ * See the file LICENSE for details.
+ **/
+
+package dev.unexist.showcase.todo.adapter;
+
+import dev.unexist.showcase.todo.domain.todo.Todo;
+import dev.unexist.showcase.todo.domain.todo.TodoDto;
+import dev.unexist.showcase.todo.domain.todo.TodoDtoAssembler;
+import dev.unexist.showcase.todo.domain.todo.events.TodoSaved;
+import io.smallrye.reactive.messaging.annotations.Broadcast;
+import org.eclipse.microprofile.reactive.messaging.Outgoing;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import java.util.Optional;
+
+@ApplicationScoped
+public class TodoProducer {
+    private static final Logger LOGGER = LoggerFactory.getLogger(TodoConsumer.class);
+
+    @Outgoing("todo-out")
+    @Broadcast
+    public TodoDto process(@Observes TodoSaved event) {
+        TodoDto dto = null;
+
+        LOGGER.info("Received event={}", event.getClass().getSimpleName());
+
+        Optional<Todo> payload = event.getPayload();
+
+        if (payload.isPresent()) {
+            Todo todo = payload.get();
+
+            LOGGER.info("Received event payload={}", todo);
+
+            dto = TodoDtoAssembler.fromTodoToDto(todo);
+        }
+
+        return dto;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/dev/unexist/showcase/todo/adapter/TodoResource.java	Sat Apr 10 15:59:33 2021 +0200
@@ -0,0 +1,57 @@
+/**
+ * @package Quarkus-Pipes-Filters-Showcase
+ *
+ * @file Todo resource
+ * @copyright 2020 Christoph Kappel <christoph@unexist.dev>
+ * @version $Id$
+ *
+ * This program can be distributed under the terms of the GNU GPLv3.
+ * See the file LICENSE for details.
+ **/
+
+package dev.unexist.showcase.todo.adapter;
+
+import dev.unexist.showcase.todo.domain.todo.TodoDto;
+import dev.unexist.showcase.todo.domain.todo.events.TodoCreated;
+import org.eclipse.microprofile.openapi.annotations.Operation;
+import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
+import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
+import org.eclipse.microprofile.openapi.annotations.tags.Tag;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+import javax.validation.Valid;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/todo")
+public class TodoResource {
+    protected static final Logger LOGGER = LoggerFactory.getLogger(TodoResource.class);
+
+    @Inject
+    Event<TodoCreated> event;
+
+    @POST
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @Operation(summary = "Create new todo")
+    @Tag(name = "Todo")
+    @APIResponses({
+            @APIResponse(responseCode = "200", description = "Todo created"),
+            @APIResponse(responseCode = "406", description = "Bad data"),
+            @APIResponse(responseCode = "500", description = "Server error")
+    })
+    public Response create(@Valid TodoDto dto) {
+        this.event.fire(new TodoCreated(dto));
+
+        LOGGER.info("Sent event={}", TodoCreated.class.getSimpleName());
+
+        return Response.ok().build();
+    }
+}
--- a/src/main/java/dev/unexist/showcase/todo/adapters/TodoConsumer.java	Sat Apr 10 15:59:12 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/**
- * @package Quarkus-Pipes-Filters-Showcase
- *
- * @file Todo consumer
- * @copyright 2020 Christoph Kappel <christoph@unexist.dev>
- * @version $Id$
- *
- * This program can be distributed under the terms of the GNU GPLv3.
- * See the file LICENSE for details.
- **/
-
-package dev.unexist.showcase.todo.adapters;
-
-import dev.unexist.showcase.todo.domain.todo.TodoDto;
-import dev.unexist.showcase.todo.domain.todo.events.TodoCreated;
-import org.eclipse.microprofile.reactive.messaging.Acknowledgment;
-import org.eclipse.microprofile.reactive.messaging.Incoming;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Event;
-import javax.inject.Inject;
-
-@ApplicationScoped
-public class TodoConsumer {
-    private static final Logger LOGGER = LoggerFactory.getLogger(TodoConsumer.class);
-
-    @Inject
-    Event<TodoCreated> event;
-
-    @Incoming("todo-in")
-    @Acknowledgment(Acknowledgment.Strategy.PRE_PROCESSING)
-    public void receive(TodoDto dto) {
-        if (null != dto) {
-            this.event.fire(new TodoCreated(dto));
-
-            LOGGER.info("Sent event={}", TodoCreated.class.getSimpleName());
-        }
-    }
-}
--- a/src/main/java/dev/unexist/showcase/todo/adapters/TodoProducer.java	Sat Apr 10 15:59:12 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/**
- * @package Quarkus-Pipes-Filters-Showcase
- *
- * @file Todo producer
- * @copyright 2020 Christoph Kappel <christoph@unexist.dev>
- * @version $Id$
- *
- * This program can be distributed under the terms of the GNU GPLv3.
- * See the file LICENSE for details.
- **/
-
-package dev.unexist.showcase.todo.adapters;
-
-import dev.unexist.showcase.todo.domain.todo.Todo;
-import dev.unexist.showcase.todo.domain.todo.TodoDto;
-import dev.unexist.showcase.todo.domain.todo.TodoDtoAssembler;
-import dev.unexist.showcase.todo.domain.todo.events.TodoSaved;
-import io.smallrye.reactive.messaging.annotations.Broadcast;
-import org.eclipse.microprofile.reactive.messaging.Outgoing;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
-import java.util.Optional;
-
-@ApplicationScoped
-public class TodoProducer {
-    private static final Logger LOGGER = LoggerFactory.getLogger(TodoConsumer.class);
-
-    @Outgoing("todo-out")
-    @Broadcast
-    public TodoDto process(@Observes TodoSaved event) {
-        TodoDto dto = null;
-
-        LOGGER.info("Received event={}", event.getClass().getSimpleName());
-
-        Optional<Todo> payload = event.getPayload();
-
-        if (payload.isPresent()) {
-            Todo todo = payload.get();
-
-            LOGGER.info("Received event payload={}", todo);
-
-            dto = TodoDtoAssembler.fromTodoToDto(todo);
-        }
-
-        return dto;
-    }
-}
\ No newline at end of file
--- a/src/main/java/dev/unexist/showcase/todo/adapters/TodoResource.java	Sat Apr 10 15:59:12 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/**
- * @package Quarkus-Pipes-Filters-Showcase
- *
- * @file Todo resource
- * @copyright 2020 Christoph Kappel <christoph@unexist.dev>
- * @version $Id$
- *
- * This program can be distributed under the terms of the GNU GPLv3.
- * See the file LICENSE for details.
- **/
-
-package dev.unexist.showcase.todo.adapters;
-
-import dev.unexist.showcase.todo.domain.todo.TodoDto;
-import dev.unexist.showcase.todo.domain.todo.events.TodoCreated;
-import org.eclipse.microprofile.openapi.annotations.Operation;
-import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
-import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
-import org.eclipse.microprofile.openapi.annotations.tags.Tag;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.enterprise.event.Event;
-import javax.inject.Inject;
-import javax.validation.Valid;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/todo")
-public class TodoResource {
-    protected static final Logger LOGGER = LoggerFactory.getLogger(TodoResource.class);
-
-    @Inject
-    Event<TodoCreated> event;
-
-    @POST
-    @Consumes(MediaType.APPLICATION_JSON)
-    @Produces(MediaType.APPLICATION_JSON)
-    @Operation(summary = "Create new todo")
-    @Tag(name = "Todo")
-    @APIResponses({
-            @APIResponse(responseCode = "200", description = "Todo created"),
-            @APIResponse(responseCode = "406", description = "Bad data"),
-            @APIResponse(responseCode = "500", description = "Server error")
-    })
-    public Response create(@Valid TodoDto dto) {
-        this.event.fire(new TodoCreated(dto));
-
-        LOGGER.info("Sent event={}", TodoCreated.class.getSimpleName());
-
-        return Response.ok().build();
-    }
-}