cancel
Showing results for 
Search instead for 
Did you mean: 

Questions around Design pattern and usage of Event Handler which are introduced in 5.15

bhuvangupta
Champ in-the-making
Champ in-the-making
USECASE:
[1] We have software system where we can create tasks and these tasks contains data about domain specific stuff.
[2] We want to use Activiti as workflow engine for our tasks.
[3] Also we want that when a process instance is created and task are created in activiti system , tasks in our system should get created with correct assigned people, due date and priorities and also task in activiti should get correct "related content" based on what our system returns.
[4] We also want that we can filter Task for which we need to create corresponding task in our system.
[5] Also give user the ability to create new task in activiti which are not part of a process instance and  user can decide whether he want to create a task in our system for this particular task.
[6] when user is done with the task , he can click a custom button on our system and task in activiti gets completed/or go in different state.

For this we are looking at using Event Handler that were introduced in 5.15.
Our Plan:
[1] Listen for all type of events and when we find an event related to task we either create or update task in our system with same taskId.
[2] Data return by our system is then saved into the task object either in variables or in "related content"
    
 Is it ok to modify task object in event handlers ?

   
 How to set/get related content from task object ?

[3] When user is done with work he will click a custom button on our system and we will use rest-api to complete that task in activiti.

Does above design pattern is good for our use case or is there a better way to achieve it ?
What is the best way to filter out task: USECASE STEP [4] and [5].

Thanks for reading this post!

3 REPLIES 3

trademak
Star Contributor
Star Contributor
Well, it would be better to work with the Activiti service interfaces like the TaskService and RuntimeService to add variables. Filtering on the task events you want to handle should be done in the event handler implementation.

Best regards,

bhuvangupta
Champ in-the-making
Champ in-the-making
>>>Well, it would be better to work with the Activiti service interfaces like the TaskService and RuntimeService to add variables
Make sense.

>>>Filtering on the task events you want to handle should be done in the event handler implementation
Which event handler you are referring to::: " the task listeners" or the "new event api" ?

If you are referring to "the task listeners" than according to my understanding it does not provides event on very activity on a task like changing description… so in the case "new event api" is the only way out..it that correct ?

jbarrez
Star Contributor
Star Contributor
I believe he means the new event api (not task listeners) indeed.