02-23-2017 10:04 AM
Hi,
I'm trying to catch all the events raised in consequence of starting or completing of serviceTask Activities.
Event types: ACTIVITY_STARTED, ACTIVITY_COMPLETED.
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:
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.
Can you please help me deal with this problem?
Thank you,
Maayan.
02-24-2017 05:44 PM
02-26-2017 02:42 AM
Thank you.
I keep trying to find an appropriate solution.
Maayan
02-26-2017 08:00 PM
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).
Regards,
Greg
02-27-2017 03:02 AM
Hi Greg,
First of all, thank you for your answer.
One problem with this solution-
I cannot be sure there will be a counter on the loop and if so, I cannot be sure what is the counter variable name.
The process model is defined by different people and I need to be able to handle each case without making any assumption about the process model flow or variables.
Is it sound like something possible?
Thank you,
Maayan
02-27-2017 09:05 AM
Yeah, if you cannot control the definition of the processes, and you don't even know if a loop is in the model, then there's not a whole helluva lot you can do.
The best thing I could suggest would be to add a parse handler to the engine and add a listener that handles the logic to make each task name unique.
The reality here is BPM is about controlling your processes, if you have no controls in place in the authoring and deployment side of things, you really aren't doing BPM.
Greg
03-01-2017 09:18 AM
Hi,
The suggestion of adding a parse handler to the engine and adding a listener that handles the logic to make each task name unique is sounds like somthing that can be helpful.
Thanks alot!
Maayan
Explore our Alfresco products with the links below. Use labels to filter content by product module.