My system is integrated with Activiti through ActivMQ by defining the property "typedEventListeners" and implementing a class that catch the events of specific types.
My system is creating an System-Entity when activity started in Activiti and closing this Entity when the activity is completed.
It saves 3 Parameters:
process Definition ID
Process Instance ID
In case my process contains a loop, means an activity occur more then once during the process execution -
I need to be able to distinguish between Activity_Started Events of the same ActivityID. So I can create in my system, for each event, an Entity with unique number, so when the Activity_Completed Event will arrive I could know which entity should be closed.
Re: How to distinguish between Activity_Started Events of the same Activity ID?
Ok, so you listener will (must) implement the ActivitiEventListener interface which gives you access to the execution context (DelegateExecution). Therefore, you have access the process instance variables. I would add a simple loop counter (if you use a serial multi-instance loop this is provided for you) as a process variable and then inside your listener add this to the Activity ID (e.g. MyTask:2).