Sequence of listeners

152 views
Skip to first unread message

roleba...@gmail.com

unread,
Jan 21, 2016, 6:42:38 AM1/21/16
to camunda BPM users
Which listener gets invoked first: create-listener or assignment-listener?

More general question: Where to find the documentation about the sequence of listeners?

thorben....@camunda.com

unread,
Jan 21, 2016, 7:31:07 AM1/21/16
to camunda BPM users, roleba...@gmail.com
Hi,

I assume you mean task listeners, right? The task lifecycle is documented at [1] and there is a stackoverflow answer [2] that may also be of interest.

Cheers,
Thorben

[1] https://docs.camunda.org/manual/latest/webapps/tasklist/task-lifecycle/
[2] https://stackoverflow.com/questions/29506960/camunda-bpmn-task-listener-vs-execution-listeners/29508312#29508312

roleba...@gmail.com

unread,
Jan 21, 2016, 10:38:26 AM1/21/16
to camunda BPM users, roleba...@gmail.com
Correct! The following service task has two task listeners:
http://s12.postimg.org/vy1tujxfx/task_listener.png

As you can see from the logic of the javascript code inside both listeners the "create" event has to be handeled prior to the "assignment" event. So I was wondering how that is managed by camunda.

Thanks to your help I learned about the task lifecycle which defines the transitions / events for task listeners.

Message has been deleted

roleba...@gmail.com

unread,
Jan 22, 2016, 5:08:22 AM1/22/16
to camunda BPM users, roleba...@gmail.com
Another part of the documentation shows that the "assignment" event gets fired before the "create" event: "This might seem like an unnatural order but the reason is pragmatic: when receiving the create event, we usually want to inspect all properties of the task including the assignee." [1]

It does not follow the task lifecycle where the "create" event is the very first event of all. So it tt looks like a contradiction between the documentation [1] and the task lifecycle. What do you think?

[1] https://docs.camunda.org/manual/7.4/user-guide/process-engine/delegation-code/#task-listener

thorben....@camunda.com

unread,
Jan 22, 2016, 5:52:47 AM1/22/16
to camunda BPM users, roleba...@gmail.com
Hi,

The documentation is incorrect there. For the initial assignment on task creation, no dedicated "assignment" event is emitted. Nevertheless, the initial assignment is executed by the engine before it emits the "create" event, so that it is possible to inspect the assignee in a "create" listener.

Thanks for pointing that inconsistency out. I'll make sure to fix this.

Cheers,
Thorben

thorben....@camunda.com

unread,
Jan 22, 2016, 6:00:43 AM1/22/16
to camunda BPM users, roleba...@gmail.com
Hi again,

Please forget the previous comment. In fact it is exactly the other way round. An assignment event can be fired before the create event is fired when an assignee is defined in the BPMN XML. Sorry for my confusion. The task lifecycle should then not be used as the reference for listener invocation order I think.

Cheers,
Thorben
Reply all
Reply to author
Forward
0 new messages