Changeset 29:4b1602463c5e

Added dispatcher instance
author unexist
date Wed, 18 Aug 2021 08:32:58 +0200
parents 41131788e51b
children e8d95600d0a2
files services/todo-service-extension/src/main/java/dev/unexist/showcase/todo/adapter/TodoSink.java
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/services/todo-service-extension/src/main/java/dev/unexist/showcase/todo/adapter/TodoSink.java	Wed Aug 18 08:19:47 2021 +0200
+++ b/services/todo-service-extension/src/main/java/dev/unexist/showcase/todo/adapter/TodoSink.java	Wed Aug 18 08:32:58 2021 +0200
@@ -11,6 +11,8 @@
 
 package dev.unexist.showcase.todo.adapter;
 
+import dev.unexist.showcase.eventsplit.EventSplitDispatcher;
+import io.quarkus.vertx.ConsumeEvent;
 import org.eclipse.microprofile.reactive.messaging.Channel;
 import org.eclipse.microprofile.reactive.messaging.Emitter;
 import org.eclipse.microprofile.reactive.messaging.Incoming;
@@ -18,29 +20,39 @@
 import org.slf4j.LoggerFactory;
 
 import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
 
 @ApplicationScoped
 public class TodoSink {
     private static final Logger LOGGER = LoggerFactory.getLogger(TodoSink.class);
 
+    @Inject
+    EventSplitDispatcher dispatcher;
+
     @Channel("todo_out")
     Emitter<String> emitter;
 
-    @Incoming("todo_in1")
+    @Incoming("todo_in")
+    public void consumeTodo(String message) {
+        LOGGER.info("consumeTodo: message={}, dispatcher={}", message, this.dispatcher);
+    }
+
+
+    @ConsumeEvent("todo_in1")
     public void consumeTodoIn1(String message) {
         LOGGER.info("consumeTest1: {}", message);
 
         this.emitter.send(message);
     }
 
-    @Incoming("todo_in2")
+    @ConsumeEvent("todo_in2")
     public void consumeTodoIn2(String message) {
         LOGGER.info("consumeTest2: {}", message);
 
         this.emitter.send(message);
     }
 
-    @Incoming("todo_in3")
+    @ConsumeEvent("todo_in3")
     public void consumeTodoIn3(String message) {
         LOGGER.info("consumeTest3: {}", message);