cancel
Showing results for 
Search instead for 
Did you mean: 

Event-based Gateway in Unit Test

gokceng1
Champ in-the-making
Champ in-the-making
Hi,
I've an event-based gateway in my process. In one outgoing flow of it there is a timer and in the other one there is a message catching event. I'm executing timer event by calling

managementService.executeJob(delayTimer.getId());

After my process ends(I thought this way), I've checked if there are any stray processes left:

List<Execution> executionList = processEngine.getRuntimeService().createExecutionQuery().list();
assertEquals(0, executionList.size());


I found that there are 2 executions left, one is the process itself and the other one is execution of event based gateway. I don't know it is normal or not. If it is not, how can I make that event-based gateway execution ends when the process ends?

PS: It is bad that I can not search 'event based' words in the forum. So maybe this question is asked before but I couldn't find.
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
Event-based gateway with 2 outgoing flows will take both outgoing paths, this is how activiti works. If you can't the process to stop, you can add a subprocess around it with a boundary-event, that has "cancelActivity=true" which ends the subprocess (and all executions in it) when the event occurs…

kiyer
Champ in-the-making
Champ in-the-making
This behavior seems counter to the intuition described in the documentation: http://www.activiti.org/userguide/#bpmnEventbasedGateway
The Join gateway in the user guide example is an Exclusive Gateway. In my understanding the behavior of the event based gateway should be:
Take a one of the mutually exclusive paths based on which event is fired first. Is the behavior mentioned above a bug?

kiyer
Champ in-the-making
Champ in-the-making
This behavior seems counter to the intuition described in the documentation: http://www.activiti.org/userguide/#bpmnEventbasedGateway
The Join gateway in the user guide example is an Exclusive Gateway. In my understanding the behavior of the event based gateway should be:
Take a one of the mutually exclusive paths based on which event is fired first. Is the behavior mentioned above a bug?

trademak
Star Contributor
Star Contributor
Hi,

The behavior of the event based gateway only will take one of the outgoing paths. The first event that's received will be processed and the event-based gateway is finished.

Best regards,