AnsweredAssumed Answered

Add EndEvent listener programmatically not working

Question asked by felipe1 on Aug 20, 2014
Latest reply on Jun 10, 2016 by maxr24
I need to add an event listener to every end event, so I'll have a way to notify users when a process instance has concluded.

I've done some research and find out this post ( that describes exactly what I want to do.

I have create a ProcessParseHandler like that:

public class ParseHandlerEndListener extends ProcessParseHandler {
   protected void executeParse(BpmnParse bpmnParse, Process process) {
      ActivitiListener endEventListener = new ActivitiListener();



And register it in my <b>activiti.cfg.xml</b>

      <property name="postBpmnParseHandlers">
            <bean class="com.mycompany.ParseHandlerEndListener" />

The listener is declared like so:

public class MyListener implements ExecutionListener {
   private static final long serialVersionUID = 1L;

   public void notify(DelegateExecution execution) throws Exception {
          // listener code

When I publish a new process, the <b>executeParse(BpmnParse bpmnParse, Process process) </b> is called as expected (I have debbuged and added some logs to check), and no exception is thrown. However, when I start and finish a process instance the <b>notify</b> method is not being called.

If I add the listener directly into the process definition the <b>notify</b> is called and everything works perfectly.

      name="Reembolso fretado"

            event="end" />