How to perform async execution without optimistic locking exception

Hi,

I have a usecase something like this in workflow:

User task -> service task -> service task-> service task-> service task-> user task.

Now when user completes 1st task, 4 service calls happens which are nothing but 3rd party api call. Now user has to wait for almost 10-12 sec before these 4 calls and finished and next form appears on screen. Now my question is how can i make these 4 service calls parallel as they are not inter dependent. Using a parallel gateway doesn’t solve the problem since it also performs in sequential order. i tried parallel gateway with async and i got optimistic locking exception. Is there a way i can call these 4 async in parallel. Also what i noticed is that when these 4 tasks are async, the main thread comes to user task directly after submitting 4 tasks to async executor. what happens if any of these 3rd party api calls failed? i want user to be taken back to 1st screen instead of 2nd screen ie rollback all the transactions. Basically i want to save users 10-12 sec(so he doesnt feel the process is slow) and also want to make sure that he doesn’t move ahead without success from all the 4 service tasks.

Thank You,
Arpit Agrawal

Hi Arpit,

Please let me know whether you solved the issue mentioned.

Regards,
!-!@ri

You can make optimistic locking exceptions for the same process instance go away by making the steps async + exclusive. Exclusive guarantees that only one step of the same process instance will be concurrently handled at the same time.