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 ?
Listeners allow you to execute external Java code or evaluate an expression when certain events occur during process execution. Listeners are a mechanism that is very often used during process development.
Execution listeners allow to instrument the execution of guest languages. For example, it is possible to attach an execution listeners that is invoked for every statement of the guest language program, similar to how a debugger would single-step through the program.
public interface TaskListener. Provides a listener to monitor the activity of the JDK Java Compiler, javac.
A user task is used to model work that needs to be done by a human actor. When the process instance arrives at such a user task, a new job similar to a service task is created. The process instance stops at this point and waits until the job is completed.
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
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With