cancel
Showing results for 
Search instead for 
Did you mean: 

User Task Enhancment to invoke custom code on task creation

manchandap
Champ in-the-making
Champ in-the-making
Respected Activiti Experts,

I have a requirement where in I want to execute a custom piece of code when a User Task is created. This custom code will make a call back to the mother application from where the workflow was initiated.

Looking at the user guide I found that Task Listeners (http://www.activiti.org/userguide/#taskListeners) can be used to enhance the User Code.

However, these task listeners need to specified as part of the template definition:

<b>
<userTask id="myTask" name="My Task" >
  <extensionElements>
    <activiti:taskListener event="create" class="org.activiti.MyTaskCreateListener" />
  </extensionElements>
</userTask>
</b>

In my case, I need this custom code to be executed for all the User tasks and don't want to rely on the inclusion of task listeners in the template definition.

So, I am looking for:

# Is there a way to enhance/customize the engine side Task or task service to achieve the same effect OR
# Is it possible to invoke the task listener for all user task without relying on the template definition

Thanks and Regards
P Manchanda
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

ad 1) yes

ad 2) yes

see:
http://activiti.org/userguide/index.html#_hooking_into_process_parsing

example: org.activiti.standalone.parsing.CustomDefaultBpmnParseHandlerTest
sets tasks to asynchronous. You can add custom listener in the similar way.

Regards
Martin