Can't set service task in parallel gateway

Hi guys , I want set some service tasks in parallel gateway and what I expected is I want to let all of them execute asynchronously . After reading our Doc , I have known that an OptimisticLockingException is thrown . There is only one service task will success , others will retry . So problem comes: My service tasks are all about http request and I found it will request repeatedly . It is a painful problem for me .

@GaoxiaoyuVV can you upload your BPMN model, will check and let you know

Hi , this is my model paralle.bpmn (7.4 KB) and each of service task have their own topic , I used camunda-external-task-client (nodejs) to subscribe topic , and related to all of this is some http request . Thank you for your kindly help .

@aravindhrs I tried to set asyncBefore = true , but nothing happened and the result was same as before . In my understand , I set a safe point that it will not retry this activity .

@GaoxiaoyuVV, please find the changes related to async in attached bpmn file.

  1. To achieve parallel execution of service tasks after gateway i have set the property for task 2/3/4 camunda:asyncBefore=“true” camunda:exclusive="false"


  1. To avoid optimistic locking exception at join gateway, i have set async:Before=true & exclusive=true

BPMN file: paralle.bpmn (8.3 KB)

@aravindhrs Hi bro , I got your idea and really thank you very much for your reply . I tried you plan and I found that my multiple service tasks are execute asynchronously . But there is another question , all of my service tasks are about http request , that means the failed task will execute many times .
I simplified my model (just two service tasks and follow your configuration) paralle (2).bpmn (6.1 KB) . Task 2 and task 3 have their own topic which is corresponding to http request using nodejs client . When process instance arrived at fork gateway , engine executed concurrently task 2 and task 3 . Then task 2 and task 3 will on the basis of their own topic to send http request , I found they were all finished . Below is my log :

and ‘— body’ is the response of my http request . Because of OptimisticLockingException it will retry first_json , and the log is:
What I mean is the “first_json” will execute twice , I want to avoid this . After trying your plan , I found that the http request will still run twice . One last word , really thank you for your kindly help bro~

Are you subscribing both topic in same external client worker? From the 1st picture, there’s exception couldn’t complete the task, so after certain period of waiting time, the lock will be released on that task and it will be polled again. That exception is for which topic?

One suggestion and better handling is external worker per topic. So each external task worker will always subscribe to one topic, and easier to manage in case of any exception.

@aravindhrs Let me get a detailed explain . For first picture , in my BPMN model there are two service tasks wanted to join parallel gateway concurrently , the log showed that the process instance threw the OptimisticLockingException and “second_json” succeed but “first_json” failed . Because the service task are all about http request , so the request have finished but the position was failed to update . The “first_json” will retry after few minutes . For this situation , “first_json” will execute twice .
By the way My external task worker always subscribe one topic , but in parallel gateway , I think the worker should trigger multiple subscribe event to achieve the purpose of asynchronization .