Listener order for the same event type

Hello,

Assuming I have a simple User Task in a CMMN model (Camunda v7.6) and I define two Case Execution Listeners (A,B) for e.g. the task’s “Start” event. Is the execution sequence of the two listeners deterministic, i.e. the first one in XML will also be the first one to be executed (A then B) or is the order not defined?

TL;DR

The reason I’m asking is I’m using the listeners to set variables, and since sentries are being re-evaluated every time a variable is set, the order in which I’m setting them produces different results in the case model.

Thanks!

Cheers, Raul

Hi @Angry_Scientist,

Internally the case execution listeners are executed in the order they are listed in the CMMN model. But I would not recommend to rely on that, since this is an internal implementation detail.

What is your use case? Maybe you could share your CMMN model?

Cheers,
Roman

You can emit other events (e.G. Spring) and use ordering there by providing the @Order. This is how we implemented a series of listeners which are attached to tasks.