cancel
Showing results for 
Search instead for 
Did you mean: 

ActivitiEventListener

davanna
Champ in-the-making
Champ in-the-making
Hi Members,

I have implemented ActivitiEventListener and put in my logic for the activiti engine to make the callbacks. I do see that  when I delete the process, I do not get callback for eve type PROCESS_CANCELLED but I get call back for ENTITY_DELETED. Has anybody faced the same issue ?

Thanks
4 REPLIES 4

hari
Star Contributor
Star Contributor
Hi,

In the above case, you are not cancelling right ? you seem to be deleting the process.

faizal-manan
Champ in-the-making
Champ in-the-making
didn't find any issue, got PROCESS_CANCELLED followed by some others event
<code>
2016-05-18 22:46:29,435 DEBUG [main] (DeleteProcessTest.java:75) - VARIABLE_CREATED
2016-05-18 22:46:29,498 DEBUG [main] (StartProcessListener.java:20) - [jumpTask:1:4-5] Process start jumpTask:1:4
2016-05-18 22:46:29,500 DEBUG [main] (DeleteProcessTest.java:75) - ENTITY_INITIALIZED
2016-05-18 22:46:29,501 DEBUG [main] (DeleteProcessTest.java:75) - PROCESS_STARTED
2016-05-18 22:46:29,504 DEBUG [main] (DeleteProcessTest.java:75) - ACTIVITY_STARTED
2016-05-18 22:46:29,527 DEBUG [main] (DeleteProcessTest.java:75) - ACTIVITY_COMPLETED
2016-05-18 22:46:29,530 DEBUG [main] (TakeProcessListener.java:24) - [5Smiley Sad(startevent1)–flow1–>(usertask1)) ] Process take:{user=zhangsan}
2016-05-18 22:46:29,531 DEBUG [main] (DeleteProcessTest.java:75) - SEQUENCEFLOW_TAKEN
2016-05-18 22:46:29,532 DEBUG [main] (DeleteProcessTest.java:75) - ACTIVITY_STARTED
2016-05-18 22:46:29,537 DEBUG [main] (DeleteProcessTest.java:75) - ENTITY_CREATED
2016-05-18 22:46:29,538 DEBUG [main] (DeleteProcessTest.java:75) - ENTITY_INITIALIZED
2016-05-18 22:46:29,552 DEBUG [main] (DeleteProcessTest.java:75) - ENTITY_CREATED
2016-05-18 22:46:29,554 DEBUG [main] (DeleteProcessTest.java:75) - ENTITY_INITIALIZED
2016-05-18 22:46:29,558 DEBUG [main] (TaskAssignedListener.java:18) - [5-7] is assigned to zhangsan (User Task1)
2016-05-18 22:46:29,564 DEBUG [main] (DeleteProcessTest.java:75) - TASK_ASSIGNED
2016-05-18 22:46:29,565 DEBUG [main] (DeleteProcessTest.java:75) - TASK_CREATED
2016-05-18 22:46:29,568 DEBUG [main] (TaskCreatedListener.java:18) - [5-7] Task Created: usertask1(User Task1)
2016-05-18 22:46:29,593 DEBUG [main] (DeleteProcessTest.java:75) - PROCESS_CANCELLED
2016-05-18 22:46:29,783 DEBUG [main] (DeleteProcessTest.java:75) - ACTIVITY_CANCELLED
2016-05-18 22:46:29,810 DEBUG [main] (DeleteProcessTest.java:75) - ENTITY_DELETED
2016-05-18 22:46:29,818 DEBUG [main] (EndProcessListener.java:18) - [5] Process end
2016-05-18 22:46:29,840 DEBUG [main] (DeleteProcessTest.java:75) - ENTITY_DELETED
2016-05-18 22:46:29,841 DEBUG [main] (DeleteProcessTest.java:75) - ENTITY_DELETED
2016-05-18 22:46:29,854 DEBUG [main] (DeleteProcessTest.java:75) - VARIABLE_DELETED
2016-05-18 22:46:29,936  INFO [Thread-4] (AbstractApplicationContext.java:960) - Closing org.springframework.context.support.GenericApplicationContext@43814d18: startup date [Wed May 18 22:46:05 SGT 2016]; root of context hierarchy
2016-05-18 22:46:30,160 DEBUG [Thread-4] (DeleteProcessTest.java:75) - ENGINE_CLOSED
</code>

davanna
Champ in-the-making
Champ in-the-making
I did record all the events that were thrown as a result of call to runtime.deleteProcessInstance(instanceId, deleteReason). I had  configured the activitilistener as follows :

  <extensionElements>
   <activiti:eventListener class="WorkflowListener" entityType="process-instance" />
  </extensionElements>

For the above configuration, following events were thrown:

********************************* ENTITY_DELETED
********************************* ENTITY_DELETED
********************************* ENTITY_DELETED

I changed the configuration as follows:

  <extensionElements>
   <activiti:eventListener class="WorkflowListener" />
  </extensionElements>

The following events were emitted for the above configuration:
********************************* ACTIVITY_CANCELLED
********************************* ENTITY_DELETED
********************************* HISTORIC_ACTIVITY_INSTANCE_ENDED
********************************* HISTORIC_ACTIVITY_INSTANCE_ENDED
********************************* HISTORIC_ACTIVITY_INSTANCE_ENDED
********************************* HISTORIC_PROCESS_INSTANCE_ENDED
********************************* ENTITY_DELETED
********************************* HISTORIC_PROCESS_INSTANCE_ENDED
********************************* ENTITY_DELETED
********************************* ENTITY_DELETED
********************************* HISTORIC_PROCESS_INSTANCE_ENDED
********************************* ENTITY_DELETED

I do not see anywhere PROCESS_CANCELLED event. The documentation for PROCESS_CANCELLED states as below:

/**
   * A process has been cancelled. Dispatched when process instance is deleted by
   * @see org.activiti.engine.impl.RuntimeServiceImpl#deleteProcessInstance(java.lang.String, java.lang.String), before
   * DB delete.
   */

Am I missing something here.

faizal-manan
Champ in-the-making
Champ in-the-making
I didn't define any eventType for my listener.