Parallel Gateway working


I am very beginner to Flowable. I have a requirement to execute two service tasks in parallel (concurrent execution) and then join their results. So I am using a parallel gateway to fork two service tasks and then join them through another gateway. The figure is uploaded. However, I always see “Form Order” task executes first and then “Branch Task” in sequence. I was expecting them to execute in concurrent way. Is my understanding wrong or I am missing anything.

The parallel gateways are made their “Exclusive” properties ON.
The service tasks are made their “Exclusive” properties ON.
None are made asynchronous.

Looking for your help. Thanks.



Hi Saby,

A process instance is by default executed in one thread. So when using a parallel gateway, you will see the first task being executed and then the second. This is to prevent possible concurrency issues. If you want to execute them in different threads in parallel then you need to define the tasks as asynchronous and exclusive = false. Then the job executor will execute the tasks in different threads in parallel. Be aware that you could have concurrency issues if the tasks set variables in the process instance execution for example. Then you will see optimistic lock exceptions. Also make sure you set the joining parallel gateway to async as well in this case and exclusive = true.

Best regards,



Thanks Tijs for your response. I will change this accordingly and get back.


Hi Tijs,

First of all thanks once again for your information. The parallel threads seems working by using asyncExecutor. However, I am facing few problems and looking for your help for those.

The design diagram is same as given earlier. The configuration is given as:

The sample code:

       ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()

       ProcessEngine processEngine = cfg.buildProcessEngine();
		AsyncExecutor aE = cfg.getAsyncExecutor();

		System.out.println("########## Process Engine Object creation completed....");

		//Deploying a process definition 
		RepositoryService repositoryService = processEngine.getRepositoryService();
		Deployment deployment = repositoryService.createDeployment()

		System.out.println("Process Definition id:"+ deployment.getId());

		ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
			System.out.println("Found process definition : " + processDefinition.getName());		    

		System.out.println("########## Deploying a process definition completed....");
  		Scanner scanner= new Scanner(;
		System.out.println("Enter a string");
		String inputStr = scanner.nextLine();
		RuntimeService runtimeService = processEngine.getRuntimeService();

		Map<String, Object> variables = new HashMap<String, Object>();
		variables.put("inputStr", inputStr);
		ProcessInstance processInstance =
		runtimeService.startProcessInstanceByKey("myProcess", variables);

Now, should I have to start and shutdown the asyncExecutor?
If I do then the “Service Task” after parallel join is not executing and the process dies.
If I don’t start the asyncExecutor then the “Service Task” is getting executed. Here I am confused. May be the process getting dead before task executes.
What should be the ideal configuration?

Also find the asyncExecutor properties…

Looking forward for your reply.

Best Regards,