Camunda BPMN - task listener versus execution listeners

I am using Camunda BPMN 2.0 for one of my working applications. In one of my utility tasks, I created a run listener at the start of the event and a task listener in the create event. I’m not sure if it’s right to assign them at the launch event at the same time. If this is correct, which one will be executed first - the executor or the task listener, when starting or creating an event, respectively?

+1
source share
1 answer

Task listeners can only be used with user tasks, since they provide callbacks when performing a task (i.e. the task that a person must complete), cf http://docs.camunda.org/latest/guides/user-guide/# process-engine-delegation-code-task-listener

Assuming you have a custom task like

<userTask id="task1" name="My task" >
  <extensionElements>
    <camunda:executionListener event="start" class="com.example.MyExecutionListener" />
    <camunda:taskListener event="create" class="com.example.MyTaskListener" />
  </extensionElements>
</userTask>

When a user task runs

  • The execution listener is called
  • Task listener called

In the general case, a task listener event loop is contained between process listening events startand end. Thus, the user task execution cycle:

  • ExecutionListener # start
  • TaskListener # create
  • TaskListener # {assignment} *
  • TaskListener # {complete, delete}
  • ExecutionListener # end
+11

All Articles