gmunozfe commented on PR #2093:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/2093#issuecomment-2358135090

   @fjtirado Failing tests are due to misalignment between the producer sending 
single events, and the consumer expecting a collection of events 
(`kogito.events.grouping `property is by default `true`).
   
   Of course, we can adapt current tests to override the property in the 
`QuarkusTestProfile` to make it `false`, and add new tests with the property to 
`true`, but my concern is that we are linking the behaviour and configuration 
of two independent components (both have to have the same configuration 
property). 
   
   So another approach could be to merge both behaviours in a single class 
(without configuration property in the consumer at least), and inside the 
"incoming annotated" method, split the flow based on the received class, 
something like this:
   
   ```
       @Incoming(KOGITO_PROCESSINSTANCES_EVENTS)
       @Transactional
       public Uni<Void> onProcessInstanceEvent(Object input) {
           if (input instanceof Collection) {
               Collection<ProcessInstanceDataEvent<?>> events = 
(Collection<ProcessInstanceDataEvent<?>>) input;
               LOGGER.debug("Process instance consumer received grouped 
ProcessInstanceDataEvents: \n{}", events);
               for (ProcessInstanceDataEvent<?> event : events) {
                   handleProcessInstanceEvent(event);
               }
           } else if (input instanceof ProcessInstanceDataEvent) {
               ProcessInstanceDataEvent<?> event = 
(ProcessInstanceDataEvent<?>) input;
               LOGGER.debug("Process instance consumer received 
ProcessInstanceDataEvent: \n{}", event);
               handleProcessInstanceEvent(event);
           } else {
               LOGGER.error("Unknown event type received: {}", 
input.getClass());
           }
           return Uni.createFrom().voidItem();
       }
   ```


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