cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a TaskListener at runtime

goldv
Champ in-the-making
Champ in-the-making
Hi,

I am trying to to initialize some process local variables when my userTask's start. The easiest was I have found t do this is to attach a TaskListener to each userTask in the process definition, and then in the notify method of the listener, I can create my local variables via:

delegate.createVariableLocal("EVENT_ID","1234576")

This seems to work ok however I have to define the same listener for each userTask Definition.

Is there a way to add a task listener to all userTask's for a given process at runtime?

I've seen the api for adding a ActivitiEventListener at runtime, however with these, I seem to lose the ability to set local variables unless I'm missing something.

Any help appreciated..
3 REPLIES 3

rhiremat
Champ in-the-making
Champ in-the-making
I also have the same requirement, appreciate any help on this!

-Raj

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I think following jUnit test from activiti sources could help you org.activiti.standalone.parsing.CustomListenerFactoryTest
Regards
Martin

goldv
Champ in-the-making
Champ in-the-making
I just found this:

https://github.com/jbarrez/activiti-advanced-scripting/blob/master/src/test/java/org/activiti/Execut...

I haven't tried it out but seems to be alon the lines of what I need.