gmunozfe commented on code in PR #3846:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3846#discussion_r1960007004


##########
springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java:
##########
@@ -89,15 +81,19 @@ public void publish(Collection<DataEvent<?>> events) {
         }
     }
 
-    protected void publishToTopic(DataEvent<?> event, String topic) {
-        logger.debug("About to publish event {} to Kafka topic {}", event, 
topic);
-        try {
-            String eventString = json.writeValueAsString(event);
-            logger.debug("Event payload '{}'", eventString);
-            
eventsEmitter.send(env.getProperty("kogito.addon.events.process.kafka." + topic 
+ ".topic", topic), eventString);
-            logger.debug("Successfully published event {} to topic {}", event, 
topic);
-        } catch (Exception e) {
-            logger.error("Error while publishing event to Kafka topic {} for 
event {}", topic, event, e);
+    protected void publishToTopic(DataEvent<?> event, String topic, String 
enabled) {
+        if (env.getProperty(String.format(ENABLED_FORMAT, enabled), 
Boolean.class, true)) {
+            logger.debug("About to publish event {} to Kafka topic {}", event, 
topic);
+            try {
+                String eventString = json.writeValueAsString(event);
+                logger.debug("Event payload '{}'", eventString);
+                eventsEmitter.send(env.getProperty(String.format(TOPIC_FORMAT, 
topic, "topic"), topic), eventString);
+                logger.debug("Successfully published event {} to topic {}", 
event, topic);
+            } catch (Exception e) {
+                logger.error("Error while publishing event to Kafka topic {} 
for event {}", topic, event, e);
+            }
+        } else {
+            logger.debug("Event {} won't be published becuase topic {} is 
disabled", event, topic);

Review Comment:
   typo
   ```suggestion
               logger.debug("Event {} won't be published because topic {} is 
disabled", event, topic);
   ```



-- 
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