AnsweredAssumed Answered

Using events to catch workflow completion not working

Question asked by blezek on Apr 1, 2014
Latest reply on Apr 2, 2014 by frederikheremans1
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;
    }

Outcomes