Multi instance Parallel not working as expected

Ok, for your Collection, do not put ${searchTypeList} but remove the dollar sign and curly brackets (since that’s the literal name of your Collection variable in your execution, it needs to match “searchTypeList”).

Also, for the Called Element, hard code the value of the process as well, and make sure the value matches the id that’s in the bpmn you’re calling. Go to Camunda modeler, open the bpmn you’re calling, and click off of any activity into the white area (not within a scope) and you should see the General Id tab there. Make sure that value matches what you have in the call activity under Called Element (or, just ensure that you have searchType as a String and its value is set in the execution and that the value matches the bpmn.

However, I’d hard code stuff until you certify it works then I’d do the substitutions with the dollar sign curly braces. Once it works, then you can go in and do this:

execution.setVariable(“searchTypeList”, myList);
execution.setVariable( “myList”, searchWorkflowList); // This list can be different if you’re swapping lists for whatever reason.

Called Element i should not hard code right, at run time it has to defined.

As you see in my bpmn diagram, for 2nd call activity, i have harded code the called element same as ID of the sub worflow, that works fine since it is single workflow.

That list contains list of sub work flow ids.

It doesn’t need to be hard-coded but the sample you have:

execution.setVariable(“searchTypeList”, searchWorkflowList);

That means the ${searchTypeList} needs to resolve to a String value of “searchTypeList”. And since you’re using “searchTypeList” as the name of the List, I think it’s not right (at least on my process that works, we have it hardcoded b/c we use the same list name every time).

That’s why I was saying to try to hardcode first, get it working, then try to use the runtime version of the list name. However, if your list name is always going to be the same, then it doesn’t make sense to have it defined at runtime.

Did as u said i removed the curly braces for list. it worked the same.

And the ${searchType} resolves to the exact value of the BPMN process Id that you’re calling? You can check the cockpit variable value to check it.

Did, this is calling only one sub work flow, which i have set.

I created a couple new services and did a parallel process, and it’s working fine for me.

child_proc.bpmn (2.8 KB)
parent_proc.bpmn (4.5 KB)
InitializeParentProc.txt (748 Bytes)
LogTask.txt (949 Bytes)

1 Like

Here are the javas and the logs. You should be able to get all this and put it in your project to try it. All 20 child procs are running within a second.

InitializeParentProc.txt (748 Bytes)
LogTask.txt (949 Bytes)
MyPojo.txt (419 Bytes)

2019-03-12 09:39:22 - INFO  com.proc.task.InitializeParentProc [http-nio-8074-exec-11] 
Calling Child Proc:
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request cafa79c1-390d-4471-950e-9b9a5ec13752=val=0
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request f4eb6bdf-5441-4d7a-aa56-8196d019bd75=val=1
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request e5edc40f-f5f7-4e7f-8e82-dbaa8ecfdcff=val=2
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request fdbeb632-1199-45da-a413-d4567d65fb50=val=3
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request da2db953-11ca-435a-b25e-583416e0fd1d=val=4
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request ad693f21-2ff4-494b-9949-cb98cf219e22=val=5
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 34b8c06c-be1e-4e68-a0c0-823f25ea2afa=val=6
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request f9d2dfbf-6889-4cff-b4f4-fa5fdc6be4fd=val=7
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request fea2568c-51b6-4f90-877c-c9bf1d00bc1d=val=8
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request a716289f-8175-47d8-88fd-adb55e7eb485=val=9
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 0f7008c5-7892-4cf9-a26d-8ffff47ebed3=val=10
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request a79d5ce9-e8b5-4220-b72e-44cc034b61af=val=11
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 6dfa6bee-a62f-4251-8304-5039a2e15c77=val=12
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request a09b94ea-7cfa-44b7-b0e3-ee5b8246b638=val=13
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request ceb81f12-4ded-4b56-9ab6-8749b1fd0cde=val=14
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 97c4bb08-2ffd-4048-b33e-440580459773=val=15
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request d2de1f3e-5a5d-477d-9aa8-23cd878975ac=val=16
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 7026ab3b-72dd-4e87-8b3d-8a5f84a24e23=val=17
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 563d131e-5c95-47ca-aa7f-37efc198ac3e=val=18
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 15bbd0e8-e29e-4d2d-afe7-09bf5a300fde=val=19
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request cafa79c1-390d-4471-950e-9b9a5ec13752=val=0 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request f4eb6bdf-5441-4d7a-aa56-8196d019bd75=val=1 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request e5edc40f-f5f7-4e7f-8e82-dbaa8ecfdcff=val=2 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request fdbeb632-1199-45da-a413-d4567d65fb50=val=3 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request da2db953-11ca-435a-b25e-583416e0fd1d=val=4 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request ad693f21-2ff4-494b-9949-cb98cf219e22=val=5 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 34b8c06c-be1e-4e68-a0c0-823f25ea2afa=val=6 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request f9d2dfbf-6889-4cff-b4f4-fa5fdc6be4fd=val=7 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request fea2568c-51b6-4f90-877c-c9bf1d00bc1d=val=8 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request a716289f-8175-47d8-88fd-adb55e7eb485=val=9 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 0f7008c5-7892-4cf9-a26d-8ffff47ebed3=val=10 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request a79d5ce9-e8b5-4220-b72e-44cc034b61af=val=11 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 6dfa6bee-a62f-4251-8304-5039a2e15c77=val=12 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request a09b94ea-7cfa-44b7-b0e3-ee5b8246b638=val=13 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request ceb81f12-4ded-4b56-9ab6-8749b1fd0cde=val=14 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 97c4bb08-2ffd-4048-b33e-440580459773=val=15 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request d2de1f3e-5a5d-477d-9aa8-23cd878975ac=val=16 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 7026ab3b-72dd-4e87-8b3d-8a5f84a24e23=val=17 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 563d131e-5c95-47ca-aa7f-37efc198ac3e=val=18 isDone:true
2019-03-12 09:39:22 - INFO  com.proc.task.LogTask [http-nio-8074-exec-11] 
Request 15bbd0e8-e29e-4d2d-afe7-09bf5a300fde=val=19 isDone:true

Thanks for your input, can you add a delay in child delegate and check. since i see its just a log much logic. cant differentiate much.

and can we have two child work flows and try.

Thanks in advance

I got the process working but got some other problem now. Still, the parallel process is working.

I took out the Thread.sleep, which seemed to cause the issue with the processes going in sequence. Then, I added a timer in the child process and set it to duration PT1M, and it starts all the processes at once and then they all run in parallel.

However, it seems like there’s some new exception coming after the call process, and I can’t figure out why, because I’m not updating any of the variables.

org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005 Execution of 'UPDATE VariableInstanceEntity[0ac5fc72-4523-11e9-9c45-d481d7c39eff]' failed. Entity was updated by another transaction concurrently.
	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(EnginePersistenceLogger.java:131)

But here’s the updated BPMN. It doesn’t matter if you have the exclusive gateways or not, it still throws the error.

2019-03-12 17:00:41 - INFO  com.proc.task.InitializeParentProc [http-nio-8074-exec-11] 
Time:2019-03-12 17:00:41.803 Calling Child Proc:
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-1] 
Child Proc: id:90fadd3e-90bf-4e15-8bb7-7174ff6e0131, field:val=0
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-1] 
Child Proc: id:a6958ad1-a083-4cd1-ab9f-c015992690fb, field:val=1
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-1] 
Child Proc: id:17c7a491-9eb7-46da-b067-22c990b5cbde, field:val=2
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-2] 
Child Proc: id:3b14958a-fac5-46df-9676-ecb3f97d66f1, field:val=3
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-2] 
Child Proc: id:6e27b5b9-1286-4477-b3c1-a195aa4a5d51, field:val=4
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-2] 
Child Proc: id:8f5d9f4f-79e1-486d-88d4-f0f1c4fd1bd5, field:val=5
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-3] 
Child Proc: id:ed71022d-a795-4bd7-95d7-a43e14a4265a, field:val=6
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-3] 
Child Proc: id:e186c7c4-9b12-46b0-875c-ba5cabf1f284, field:val=7
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-3] 
Child Proc: id:dfa397bd-353e-4b3a-a6fe-4b581e1a9911, field:val=8
2019-03-12T17:00:42.248-0700 WARN [cadi] WARNING! BasicAuth has been used over an insecure channel
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-1] 
Child Proc: id:4c826b64-75a1-4c36-8ae0-ce7b498ee6b6, field:val=9
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-1] 
Child Proc: id:d8f068fa-4262-41df-87a4-641e82d80c9b, field:val=10
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-1] 
Child Proc: id:9547b584-8ff4-4ce0-a241-23f1907189cf, field:val=11
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-2] 
Child Proc: id:f60cb290-3727-446a-b589-c087aac400c8, field:val=12
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-2] 
Child Proc: id:d12630aa-91a6-4746-ac77-476fe5f44b86, field:val=13
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-2] 
Child Proc: id:655605b0-c65b-4e63-8870-661f91451680, field:val=14
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-3] 
Child Proc: id:233cabd3-93ae-49d3-89fa-84d0b86f7f2c, field:val=15
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-3] 
Child Proc: id:a0149455-9349-4ae2-ad12-82f6a2fd9013, field:val=16
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-3] 
Child Proc: id:a6e2e125-94cc-410e-8a47-bcc81d0f0590, field:val=17
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-1] 
Child Proc: id:96363467-e7bf-4757-a2ce-a1f568811549, field:val=18
2019-03-12 17:00:42 - INFO  com.proc.task.LogItem [camundaTaskExecutor-1] 
Child Proc: id:0743b71a-df7d-44dc-9f8a-89a621194564, field:val=19
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 90fadd3e-90bf-4e15-8bb7-7174ff6e0131:val=0
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request a6958ad1-a083-4cd1-ab9f-c015992690fb:val=1
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 17c7a491-9eb7-46da-b067-22c990b5cbde:val=2
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 3b14958a-fac5-46df-9676-ecb3f97d66f1:val=3
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 6e27b5b9-1286-4477-b3c1-a195aa4a5d51:val=4
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 8f5d9f4f-79e1-486d-88d4-f0f1c4fd1bd5:val=5
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request ed71022d-a795-4bd7-95d7-a43e14a4265a:val=6
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request e186c7c4-9b12-46b0-875c-ba5cabf1f284:val=7
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request dfa397bd-353e-4b3a-a6fe-4b581e1a9911:val=8
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 4c826b64-75a1-4c36-8ae0-ce7b498ee6b6:val=9
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request d8f068fa-4262-41df-87a4-641e82d80c9b:val=10
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 9547b584-8ff4-4ce0-a241-23f1907189cf:val=11
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request f60cb290-3727-446a-b589-c087aac400c8:val=12
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request d12630aa-91a6-4746-ac77-476fe5f44b86:val=13
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 655605b0-c65b-4e63-8870-661f91451680:val=14
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 233cabd3-93ae-49d3-89fa-84d0b86f7f2c:val=15
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request a0149455-9349-4ae2-ad12-82f6a2fd9013:val=16
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request a6e2e125-94cc-410e-8a47-bcc81d0f0590:val=17
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 96363467-e7bf-4757-a2ce-a1f568811549:val=18
2019-03-12 17:01:18 - INFO  com.proc.task.LogList [camundaTaskExecutor-1] 
Request 0743b71a-df7d-44dc-9f8a-89a621194564:val=19

InitializeParentProc.txt (952 Bytes)
LogItem.txt (558 Bytes)
LogList.txt (637 Bytes)

child_proc.bpmn (4.0 KB)
parent_proc.bpmn (6.5 KB)

hi thanks for your input, for me still its not working. according to your example, there is only one child workflow , can we have multiple child workflow and try.

Thanks in Advance.

Just use Async Before under Asynchronous Continuations instead of under Multi-instance section. It will work, but I think this should have worked even without this “trick”.

@gowtham_m, I seem to have the exact same problem as you, I have an activity that I want to call in parallel and it doesn’t seem to be activated like this. I have tried all of the available async checkboxes.
Did you figure it out?

Hi @Oron_Cohen,
In addition to the above one i did a work around, in the sub workflows on the start event I added async before/after.

it will work almost the same.

hi, It did not work for me as well, In the inner sub process if one service tasks of index item 2 waits for 2 seconds then other index items 3,4,5, etc ( total of 10) also have to wait for index 2 item to complete.

make service tasks as async, it will work