agrz opened a new issue, #1454:
URL: https://github.com/apache/incubator-kie-issues/issues/1454

   ### Description
   In the current snapshot/10.rc versions, the Spring boot addon for events 
with Kafka no longer allows disabling of events.
   The properties to enable/disable are still there but not evaluated anymore:
   
https://github.com/apache/incubator-kie-kogito-runtimes/blob/main/springboot/addons/events/kafka/src/main/java/org/kie/kogito/events/spring/KafkaEventPublisher.java
   It was changed during some refactoring in this commit: 
https://github.com/apache/incubator-kie-kogito-runtimes/commit/70af322775e8746c252d20b4e08a9cae3079652b#diff-c303ee44771734ad74a5c842795f89c3e894442f7161e08f9adde73f9565fa46
   It works in last released versions. This is causing some troubles for local 
unit testing and ci/cd testing where no Kafka is enabled. When the addon tries 
to send an event without Kafka, it will try for a timeout of 60s, pausing the 
complete process execution. This basically breaks the complete usage then.
   
   ### Expected behavior:
   Setting in the configuration any of kogito.events.processinstances.enabled, 
kogito.events.processdefinitions.enabled or kogito.events.usertasks.enabled to 
false will no longer send those events over Kafka.
   
   ### Actual behavior:
   Those settings are ignored and the addon always tries to send the events 
over Kafka once added as dependency to the maven project of a spring boot 
service.
   
   ### Proposed solution:
   Adding the check for the event sending again into the code, i.e. like this:
   `  @Override
       public void publish(DataEvent<?> event) {
   
           switch (event.getType()) {
               case "ProcessInstanceErrorDataEvent":
               case "ProcessInstanceNodeDataEvent":
               case "ProcessInstanceSLADataEvent":
               case "ProcessInstanceStateDataEvent":
               case "ProcessInstanceVariableDataEvent":
                   publishToTopic(event, PROCESS_INSTANCES_TOPIC_NAME, 
processInstancesEvents);
                   break;
               case "UserTaskInstanceAssignmentDataEvent":
               case "UserTaskInstanceAttachmentDataEvent":
               case "UserTaskInstanceCommentDataEvent":
               case "UserTaskInstanceDeadlineDataEvent":
               case "UserTaskInstanceStateDataEvent":
               case "UserTaskInstanceVariableDataEvent":
                   publishToTopic(event, USER_TASK_INSTANCES_TOPIC_NAME, 
userTasksEvents);
                   break;
               case "ProcessDefinitionEvent":
                   publishToTopic(event, PROCESS_DEFINITIONS_TOPIC_NAME, 
processDefinitionEvents);
                   break;
               default:
                   logger.debug("Unknown type of event '{}', ignoring for this 
publisher", event.getType());
           }
       }
   
       protected void publishToTopic(DataEvent<?> event, String topic, boolean 
enabled) {
           if (enabled) {
               publishToTopic(event, topic);
           } else {
               logger.debug("Event {} is disabled, not publishing to topic {}", 
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