cancel
Showing results for 
Search instead for 
Did you mean: 

ExecutionListener in BpmnModel

gguimezanes
Champ in-the-making
Champ in-the-making
Hello
I am working on an application in which we have our own internal model for representing a workflow but would like to delegate the core workflow processing to activiti.
Thus I am transorming our own model into a org.activiti.bpmn.model.BpmnModel, then transforming the model to xml using BpmnXmlConverter so that I can deploy the resulting xml in activiti engine.
I want to add executionListeners on all activities and intermediate catching events, so that I can update our own internal model when things happen.
I have run into several difficulties :

1) If I add an ExecutionListener on a UserTask, it is not taken into account in the XML converter (check BaseBpmnXmlConcerter.writeListeners and you will see that it takes oinly into account the taskListeners, not the executionListeners)
=> is that how Activiti works? Can we only have task listeners on user tasks, or is it a limitation on the xml converter only?

2) I don't seem to be able to add any listener to an IntermediateCatchEvent. The getExecutionListeners() method is defined on Activity and IntermediateCatchEvent is not in the same hierarchy.
=> on http://www.activiti.org/userguide/index.html#executionListeners I saw that executionListeners were actually supposed to work with start and end of intermediate events, so I assume it's a limitation on the BpmnModel, not on the engine… or did I miss a way to do it?

3) Not a question, just a suggestion : my code is more difficult to write because there is no common interface between Process and SubProcess (for the addFlowElement method). Would be really great to create interfaces for the methods in common between objects that do not have the same hierarchy so that we can manipulate them more easily!
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
1) Execution-listeners can be added to any activity in Activiti, tasks included. This seems to be a limitation of the BPMNConverter
2) I don't see any reason why listeners won't work on intermediate events in the engine, so indeed a limitation of the explorer.

Can you create a JIRA-issue with these findings in it? Thanks!

gguimezanes
Champ in-the-making
Champ in-the-making
Done:
1) issue ACT-1558 (bug)
2) issue ACT-1559 (improvement)
Thanks

jbarrez
Star Contributor
Star Contributor
I believe I have fixed 1) and 2) just now on master. Fred, could you check and confirm?