flowable engine version: 6.3.1
In our BPMN flow, we have two intermediate catch events behind the same Event-Based gateway - one message intermediate catching event, one timer intermediate catching event (which will be triggered in 30 minutes). We have done some testing with this BPMN flow as below:
- Sends a message which triggers the message intermediate catching event. And everything after executes just as expected.
- Wait for 30minutes, the timer intermediate catching event is triggered. (which is supposed to be auto deleted after step 1, according to our understanding). This is unexpected and confusing.
We tried to look at flowable source code for explanation, and found below comment in IntermediateCatchEventActivityBehavior:
/** * Specific leave method for intermediate events: does a normal leave(), except when behind an event based gateway. In that case, the other events are cancelled (we're only supporting the * exclusive event based gateway type currently). and the process instance is continued through the triggered event. */ public void leaveIntermediateCatchEvent(DelegateExecution execution)
But the behavior we observed is inconsistent with the comment we found - which says the other events are supposed to be cancelled.
Further more, we found that in the deleteOtherEventsRelatedToEventBasedGateway method of IntermediateCatchEventActivityBehavior:
// Execute the cancel behaviour of the IntermediateCatchEvent for (ExecutionEntity executionEntity : executionEntities) { if (eventActivityIds.contains(executionEntity.getActivityId()) && execution.getCurrentFlowElement() instanceof IntermediateCatchEvent) { IntermediateCatchEvent intermediateCatchEvent = (IntermediateCatchEvent) execution.getCurrentFlowElement(); if (intermediateCatchEvent.getBehavior() instanceof IntermediateCatchEventActivityBehavior) { ((IntermediateCatchEventActivityBehavior) intermediateCatchEvent.getBehavior()).eventCancelledByEventGateway(executionEntity); eventActivityIds.remove(executionEntity.getActivityId()); // We only need to delete ONE execution at the event. } } }
Should we use “executionEntity” variable instead of “execution”? Is this a possible bug? This behavior has bothered us for quite some time. Thank you for you help!