cancel
Showing results for 
Search instead for 
Did you mean: 

Async process start

alexbt
Champ in-the-making
Champ in-the-making
Hello Activiti Team,

My question is about asynchronous process start.
As far as I understand the Activiti API the only way to start a process instance is by calling either
RuntimeService.startProcessInstanceByKey(…) or RuntimeService.startProcessInstanceById(…)
But those methods run in a synchronous manner until they encounter a wait state, and after that they return a processInstance.
Is there a way to start the process and and get the processInstance even before executing the first task? So that it will look like async execution.
Or maybe I misunderstand the API. Please correct me if I'm wrong.

Thanks,
Alex
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Hi,

No you are right. What you can do is use the async attribute on the first task.
So then the process will be started, and the start event will be processed and the first sequence flow will be taken. But when the first task needs to be processed, it will do it asynchronously.
So you get the process instance back from the startProcessInstanceByKey method before the process engine will execute the first task.

Best regards,

alexbt
Champ in-the-making
Champ in-the-making
Tijs,

Thanks you very much for the fast reply.
BTW, your book is a great help for me. Looking forward to reading the unpublished chapters 😉

Alex