I have an application with lot of modules, one of them is the activiti BPM engine. I use elasticsearch (ES) as the datastore. There is also a web application, which serves as a trigger to executing the processes and providing data. Every process has its instance in the ES and the available list of tasks (the mapping to the activiti task instances) is also stored in the process metadata. I've been playing around with synchronization of the tasks list between the BPM engine and the datastore and I am still not satisfied. What I am doing is following - the workflow of the application:
The problems are following. First of all I would need to define such a TaskListener on every task in the process (there are about 150 complex processes). Second problem is, that the when the TaskListener is called and query the engine for the tasks I am not getting the just created task in there (I suppose this is because of the listener being called before the task entity is created, or the transaction committed).
So the question is, what is the best way to configure some kind of a global listener for the engine which notifies me every time when there is something changed with any process from the deployment so I can query the tasks list and update the ES?
Thank you,
Filip
Not sure what version of Activiti you are using, but if it is something relatively new, I would make use of the Event Handler mechanism that was added to the engine about a year ago:
Activiti User Guide - Event Dispatcher
Event handlers can be defined globally or for an individual process instance and can be mapped to a number of standard events (such as task creation).
Adding a global listener to the TASK_CREATED event should satisfy your needs.
Greg
This is indeed possible. But the problem still is that the transaction most probably has not been completed yet. This way you can obtain the TASK entity, but when you in this moment query the BPM Runtime to get the list of tasks, it would not be present in the list.
Actually, the event listener is not triggered until after the commit operation, so the task entity should actually be retrievable.
Greg
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.