cancel
Showing results for 
Search instead for 
Did you mean: 

New Task Event Listeners

pprestin
Champ in-the-making
Champ in-the-making
I'm attempting to add sub tasks to a parent user task. Existing event listeners do not appear to be triggered when these tasks are added to the parent task.

Is there existing functionality to inform activiti that I would like to attach/invoke existing listeners to these new dynamically created tasks? How would I go about accomplishing this?
8 REPLIES 8

jbarrez
Star Contributor
Star Contributor
What kind of event listener do you mean, and how do you associate them with these new subtasks?

pprestin
Champ in-the-making
Champ in-the-making
Task listeners and your question is the same as mine. I'm looking for listeners on create, assign, complete, delete. I'm not sure how to go about associating task listeners with dynamically created sub tasks.

trademak
Star Contributor
Star Contributor
Task listeners only work with user tasks defined in a process definition. So for dynamically created sub tasks this doesn't work.
We will support a new event infrastructure in Activiti 5.15 which does support sub tasks as well.

Best regards,

frederikherema1
Star Contributor
Star Contributor
Yes, indeed. As Tijs said, task-listeners work only for tasks DIRECLTY involved in a process. Subtask of a task that is part of a process won't trigger TaskListeners.

The new mechanism will support adding event-listeners to the whole engine, to allow for receiving events when a task is created, assigned, completed, deleted, suspended, activated, … Current master already has 90% of this support pushed, so you can take a look before it's actually released.

pprestin
Champ in-the-making
Champ in-the-making
Thanks all for your helpful feedback. I'm looking to implement near exactly what's described in the follow post http://forums.activiti.org/content/adding-participants-workflow

Essentially the ability to ad-hoc create additional tasks at run-time. I'm wondering if any of the core team has interesting ideas to simulate this type of functionality with current functionality (v5.13)? Re-parse an existing active multi-instance task? Some sort of sequence flow with conditional that would re-execute a multi instance? I've been churning on this for a while and am in need of fresh ideas.

jbarrez
Star Contributor
Star Contributor
Depending on how tighly coupled you want those tasks, you could always get the engineServices.getTaskService and create the task through the generic service. As it is part of the same transaction, that should work as it doesn't affect the running process.

aimingxu
Champ in-the-making
Champ in-the-making
Not sure if I missed anything but I am interested in the current status. Can task listeners work with dynamically created sub tasks now?

Thanks,
Aiming

jbarrez
Star Contributor
Star Contributor
No, i don't believe so.