cancel
Showing results for 
Search instead for 
Did you mean: 

Task Migration using Activiti in distributed way

asshetye
Champ in-the-making
Champ in-the-making
Hi,

I am involved in research project where I need to migrate task over a set of host machines (i.e. to run the task in the data proximity rather than migrating the data like general scientific workflows.). The migration will be done by evaluating certain constraints in the process.  I was wondering if I could develop this functionality over activiti engine. I have  trying to figure out ways to maybe suspend the process instance one machine and activate the instance on other machine so it runs on that machine. Somebody suggested that I use same database for all the engines on different hosts.

I am successful in doing that but I have to include wait states inside the definition so that I can signal the receive tasks using  rest api to activate the instance on other machine. This means every time I need a process to run in distributed manner I have to modify the process to include wait states. I was wondering if there would be another way to do so. Any suggestions

Thanks in advance
3 REPLIES 3

trademak
Star Contributor
Star Contributor
If you make the tasks in the process definition asynchronous our job executor will already do everything distributed (when using Activiti on multiple servers with the same database) by default. Or do you want specific distributed behavior?

Best regards,

asshetye
Champ in-the-making
Champ in-the-making
Yes I want to particularly stop the task on one host and try to run it on different host (not halt the execution of task but halt the process before executing that task) and maybe bring back the control to the host originally running the process after finishing the task. Any ideas appreciated.  

Best

frederikherema1
Star Contributor
Star Contributor
When an activity is marked as "async", the execution halts and the process-state is persisted. Next, the job is picked up by the job-executor and executes the "async" activity and all activities after it until a wait-state is reached, end is reached or another async-activity is reached.

You could, for example, disable the jobExecutor on machine1 and enable it only on machine2. All asynchronous activities are always executed on machine2. When you put receiveTasks of user tasks after the async-activities, machine1 can then see these tasks and complete them to continue execution of the process on machine1.

However, if you want to have a more flexible system, you should create you're own solution with some kind of queuing, combined with receive-task/signal mechanism to indicate the work on machine2 is finished.