Terminate event doesn't work as expected

Hello, can you explore my diagram and explain, why all subprocess tokens aren’t terminating? By my undertanding they should vanish when a == 3. It seems to be that terminate event kills only last token and not the first two.


test.bpmn (7.5 KB)

Hello @Mikhail.Savelov ,

the Terminate End Event only works inside the scope it lives, here the Event-based subprocess. What you could do now is this:

Or even easier:

Hope this helps

Jonathan

1 Like

Thank you, but I did not understand this example. I constructed my test to clarify behaviour of terminate event.

Terminate event kills tokens inside its scope. So I expect this:

  • 5 sec: first token is going through the top path and stops at user task
  • 10 sec: second token is going through the top path and stops at user task
  • 15 sec: third token is going through the bottom path and terminate-event kills ALL three tokens.

But it only kills third token, and everything after it. First two tokens remains untouched. I simply want to understand, why is it happening? Shouldn’t Terminate-event clean my subprocess entirely?

Hello @Mikhail.Savelov ,

every time the timer is triggered, a new instance of your event-based subprocess is created (behaviour of a Start Event). Inside this instance, all tokens will be consumed by the Terminate End Event.

You can see this on the bottom left of your screenshot, where the event-based subprocess is annotated with a “2”. So, 2 instances are active, 1 was ended.

Jonathan

It makes sense now, thank you.

1 Like

This may be unjustified, but I don’t trust conditional events (conditions might be transient and not detected by the engine) and prefer explicit event firing. Hence, in the solution of @jonathan.lukas, I’d made the following changes:

  1. In the 5-secs subprocess, insert a condition (XOR) with “a==3?”. If yes, then throw an error or an escalation event.
  2. In the bottom right subprocess, replace the conditional start event with the error or escalation start event.

Has anybody used conditional events extensively? What is your experience?