cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically add an execution listener

jorell
Champ in-the-making
Champ in-the-making
I need to send out a generic notification every time a process ends. I dont want to require all my users to add an execution listener to the end event and call my java code. Seems very redundant. I would much rather do that on my side.
Ideally if I can have a generic listener for the engine to call a certain delegate when the end event occurs for any process instance that would be the best solution. I tried but couldnt find any such generic hooks.
Alternatively another solution can be if I add an execution listener programmatically each time a process definition is deployed. My only restriction here is that I can't change the stored process definition text since the client should be able to retrieve the original text and compare and make changes. This second solution should be possible but I can't seem to find a way to do this. Any suggestion would be appreciated.
Thanks.
4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Jorell
have a look on org.activiti.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory#createNoneEndEventActivityBehavior
you can register your own factory.

jorell
Champ in-the-making
Champ in-the-making
Thanks! I'll take a look.

kayj
Champ in-the-making
Champ in-the-making
Hi,

I'm facing the same problem. I'd like to get notified whenever a process is finished, but I don't like to add ExecutionListener to the bpmn model. I already had a look at DefaultActivityBehaviorFactory, but didn't figure out how to use it, since there is no documentation available. Furthermore the posting is 2 years old, so there might be a different solution now. Any suggestions?

jbarrez
Star Contributor
Star Contributor
Using an execution/event listener is indeed the way to go there.

DefaultActivityBehaviorFactory plugs into the ProcessEngineCOnfiguration. You can inject your own subclass of it.