In here the service task is hitting an API until the desired response is found, then it correlates the “JobCompleted” message to the receive task. The process then gets forwarded towards sending the mail.
The issue is when two instances are fired to the process definition, both the instances after getting successful response from the API correlate to the same key of message for receive task, and that throws an exception.
I have attached the cockpit and eclipse code of service task.
The console containing error also, till the time the timer is running there is no error but as soon as message correlation comes in picture it gets conflicted when at a time 2 or more instances are running. Note: When there is only one instance running the process flow is perfect.