Camunda BPMN - Task listener vs Execution listeners

丶灬走出姿态 提交于 2019-12-06 01:35:41

问题


I've been using Camunda BPMN 2.0 for one of my workflow applications. In one of my service tasks, I created an execution listener at the start event and a task listener at the create event. I'm not sure whether it's proper to assign these simultaneously at the start event. If it's correct, which one of them will be getting executed first - Execution listener or Task Listener, at start or create event, respectively ?


回答1:


Task listeners can only be used with user tasks, since they provide callbacks when task (i.e. the task a human has to perform) state changes, cf http://docs.camunda.org/latest/guides/user-guide/#process-engine-delegation-code-task-listener

Assuming you have a user 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 the user task is executed

  1. The execution listener is called
  2. The task listener is called

In general, the task listener event cycle is contained between execution listener events start and end. So the cycle when a user task is executed is:

  1. ExecutionListener#start
  2. TaskListener#create
  3. TaskListener#{assignment}*
  4. TaskListener#{complete, delete}
  5. ExecutionListener#end


来源:https://stackoverflow.com/questions/29506960/camunda-bpmn-task-listener-vs-execution-listeners

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!