My intention is to have a listener that gets invoked once, when both A and B are finished. Therefore I attach the listener to the join parallel gateway using an end event. However, the actual behavior is that the listener gets invoked twice (for A and B each). Here’s how it is implemented:
Because the event name is EVENTNAME_END I expect it to be invoked when it is about to leave the activity it is attached to (the parallel gateway). In reality, the listener gets invoked twice. Why is it?
@tftol As you can see two execution tokens at the parallel tasks after the parallel gateway (fork) will be getting merged or synchronised at the parallel gateway (join). So once the execution tokens arrived at the parallel gateway (join) you can find execution token count will be 1, so the listeners will get executed only once.
@tftol if the listener is attached at the gateway level, then it will get triggered for each arrival of the execution tokens. Only the outgoing execution path from gateway will have one execution token.
so does that mean that if i want just one token, the only solution is to attach the listener to the task after the gateway? it is not a bug/intentional that the number of invocations of a listener attached to a gateway’s END event do not correspond to the # of outgoing tokens?
After the parallel gateway it will be only one execution token exists. It’s better not to have a listeners in parallel join gateway if you wanted that listener should be executed only once.