martinweiler commented on code in PR #4146:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4146#discussion_r2770311867


##########
api/kogito-api/src/main/java/org/kie/kogito/process/ProcessInstances.java:
##########
@@ -56,4 +56,20 @@ default Stream<ProcessInstance<T>> 
waitingForEventType(String eventType) {
     }
 
     Stream<ProcessInstance<T>> waitingForEventType(String eventType, 
ProcessInstanceReadMode mode);
+
+    default Stream<ProcessInstance<T>> acceptingEventType(String signalName, 
String id) {
+        return findById(id, ProcessInstanceReadMode.MUTABLE)
+                .filter(pi -> {
+                    // Check if waiting for event (traditional signal event)
+                    boolean isWaitingForSignal = Stream.concat(
+                            waitingForEventType(signalName, 
ProcessInstanceReadMode.READ_ONLY),
+                            waitingForEventType("Message-" + signalName, 
ProcessInstanceReadMode.READ_ONLY)).anyMatch(p -> p.id().equals(id));
+
+                    boolean isAdHocNode = pi.adHocFragments().stream()
+                            .anyMatch(fragment -> 
fragment.getName().equals(signalName));
+
+                    return isWaitingForSignal || isAdHocNode;
+                })
+                .stream();
+    }

Review Comment:
   @fjtirado without this change, we are seeing failures in the 
[EventFlowIT](https://github.com/apache/incubator-kie-kogito-runtimes/blob/main/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/EventFlowIT.java#L90)
 test. We were hoping you could shed some more light on this. Thanks!



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