cancel
Showing results for 
Search instead for 
Did you mean: 

Listen to generic events

bernd_ruecker
Champ in-the-making
Champ in-the-making
Hey guys.

The Event Bus didn't made it into Activiti, now I ask myself: How can I register generically for a certain event, not dependant to a specific instace. For example: "Call this Listener evey time any process instance ends". Or "every time I enter a state"… Use case is to plugin some monitoring and cleanup.

Is there a clean and easy way for this?

Thanks
Bernd
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
Bernd,

The way I solve this in Alfresco integration is the folowing:

- Add a custom BPMNParseListener, eg:

<!– BPMN Parse listener which adds tasklisteners to all userTasks –> 
  <bean id="activitiParseListener" class="org.alfresco.repo.workflow.activiti.AddTaskListenerParseListener">
   <property name="createTaskListener" ref="activitiCreateTaskListener" />
   <property name="completeTaskListener" ref="activitiCompleteTaskListener" />
  </bean>

   …

  <bean id="engine" ….
     <property name="customPreBPMNParseListeners" ref="activitiParseListener" />


- The parse-listener adds taskListener (create and complete) to all UserTasks parsed. In our case, you should use the parseProcess listener call to add event-listener(s) to all processes.

This way, all activiti tasks in alfresco are wired to perform some magic Smiley Wink

bernd_ruecker
Champ in-the-making
Champ in-the-making
Ah, that was it. I remembered some workaround but forgot it. Thanks.
To have a generic Event Listening Mechanism isn't planned, right?

Hope you had a good trip back to belgium and thanks again for the team beers 😉
Cheers
Bernd

tombaeyens
Champ in-the-making
Champ in-the-making
No other listener mechanism is planned then the ones that are there now: one for executions and one for tasks.