Difference of TaskListener and ExecutionListener in User Task

I want to run delegation after a user complete the task,
which listener I should use?

What is the difference of TaskListener and ExecutionListener in User Task,
and what is their execution sequence?

Thank you.

This question is already answered.


I think the important difference to remember is that the ExecutionListener is available for all elements and allows access to the DelegateExecution, while the TaskListener only applies to tasks (bpmn and cmmn) and gives you access to the DelegateTask.

The DelegateTask is important for all task-lifecycle operations, like setting due date, assigning candidate groups, … you just cannot do this with the DelegateExecution.

So in general, we use ExecutionListeners on events and gateways, JavaDelegates on ServiceTasks and TaskListeners on UserTasks.