nmirasch commented on code in PR #3380:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3380#discussion_r1469887535


##########
quarkus/addons/events/process/runtime/src/main/java/org/kie/kogito/events/process/ReactiveMessagingEventPublisher.java:
##########
@@ -114,31 +121,48 @@ public void publish(Collection<DataEvent<?>> events) {
         }
     }
 
-    protected void publishToTopic(DataEvent<?> event, MutinyEmitter<String> 
emitter, String topic) {
+    protected void publishToTopic(BiConsumer<MutinyEmitter<String>, 
Message<String>> consumer, DataEvent<?> event, MutinyEmitter<String> emitter, 
String topic) {
         logger.debug("About to publish event {} to topic {}", event, topic);
+        Message<String> message = null;
         try {
             String eventString = json.writeValueAsString(event);
-            Message<String> message = 
decorateMessage(ContextAwareMessage.of(eventString));
-
             logger.debug("Event payload '{}'", eventString);
-            emitter.sendMessageAndAwait(message);
-
+            message = decorateMessage(ContextAwareMessage.of(eventString));
         } catch (Exception e) {
-            logger.error("Error while creating event to topic {} for event 
{}", topic, event, e);
+            logger.error("Error while creating event to topic {} for event 
{}", topic, event);
+        }
+        if (message != null) {
+            consumer.accept(emitter, message);
         }
     }
 
-    protected CompletionStage<Void> onAck(DataEvent<?> event, String topic) {
-        logger.debug("Successfully published event {} to topic {}", event, 
topic);
+    protected CompletionStage<Void> onAck(Message<String> message) {
+        logger.debug("Successfully published message {}", message);
         return CompletableFuture.completedFuture(null);
     }
 
-    protected CompletionStage<Void> onNack(Throwable reason, DataEvent<?> 
event, String topic) {
-        logger.error("Error while publishing event to topic {} for event {}", 
topic, event, reason);
+    protected CompletionStage<Void> onNack(Throwable reason, Message<String> 
message) {
+        logger.error("Error while publishing message {}", message, reason);

Review Comment:
   @fjtirado it remains another {} to see the `reason` in log.error



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to