cancel
Showing results for 
Search instead for 
Did you mean: 

Using events to catch workflow completion not working

blezek
Champ on-the-rise
Champ on-the-rise
We're using the new Events API to catch when a workflow starts, but in our testing, we never seem to get an event corresponding to a workflow completing.  Is there a better way to do this?  Pseudo code below:


public class WorkflowEventListener implements ActivitiEventListener {



   if (event instanceof ActivitiEntityEvent) {
      ActivitiEntityEvent e = (ActivitiEntityEvent) event;
      if (e.getEntity() instanceof ExecutionEntity) {

        ExecutionEntity ent = (ExecutionEntity) e.getEntity();
        if (ent.isProcessInstanceType()) {
          log("Event: " + e.getType() + " " + ent.toString() + " " + e.getProcessDefinitionId() + " " + new DateTime());
          if (event.getType() == ActivitiEventType.ENTITY_CREATED) {
           // Log that a workflow started
          } else if (event.getType() == ActivitiEventType.ENTITY_DELETED) {
            // Log that a workflow was completed
            //  NEVER GETS CALLED!!!!
          }
        }
      }
      return;
    }
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
Where exactly do you add the event-listener? Is it added through the process-definition or on a global level?

Can you create a simple unit-test, demonstrating the problem? See the sticky in the forum to get a unit-test skeleton setup quickly…