I want synchronous executions of task in activiti,but I have a long running task which might take 20 minutes to execute. I wanted to get process instance id quickly in my controller without considering completion of task in bpmn,so I added a intermediate timer event of "0 minute" in my bpmn file.
I have started executing a process,lets say with processInstanceid p1.At that time only I again start the process,lets say with processInstanceid p2. Now both processes arrive till the task where there is a wait event of 20 minutes(I have used while loop for this).Now according to the flow both processes should come till the end task and finish their execution but instead of that none of the process finish its execution and run multiple times from first task to end task.
how to run multiple processes independently and parallaly from start task to end task (one of these tasks have code which will take long time to execute)
If you have a long running task make it async. Async doesn't mean that the process will move forward without waiting for the task to be completed. It only means that the task will be executed in another thread which will be in charge of notifying the process when the task is done. So to answer to your question, use Async tasks.