cancel
Showing results for 
Search instead for 
Did you mean: 

Start activiti process through Java code

ambikakhatri
Champ in-the-making
Champ in-the-making
Hi,

  When I call runtimeService.startProcessInstanceByKey(processName, processVariables), activiti process gets started identified by processName. Suppose I am in clustered environment and start process using above code. Will activiti process run in a different node? My requirement is that I want this process to be picked by any node and not necessarily the node where this code was executed. If not this way, how can I achieve this? Using message instead of processId (as below) getProcessEngine().getRuntimeService().startProcessInstanceByMessage('somemessage')
to start process would help me achieve this?

Thanks in advance,
Ambika
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
No, if you use startProcessInstanceByKey it will execute where it's called.
To execute on other nodes, make the second step of your process async. The job executor (potentially on other nodes) will pick it up.
Otherwise, you'll need to add your own messaging infrastructure that calls the startProcessInstanceByKey method.