I am planning a simple workflow (shown in blue on the right) which should receive shipments belonging to the same order and continue the flow once all shipments have been collected.
Receiving shipments happen via REST and I plan to correlate to the right workflow instance using the order_id which is part of the request. The REST service is running in a cluster, so no in-VM locking is possible at this point.
I see two serious issues with this design:
- concurrent inbound shipment requests will fail to correlate so they will start multiple workflow instances in the same time
- even if the flow is started once successfully, Camunda will throw concurrent modification exception when simultanous shipment requests try to update the same workflow instance’s variables
How can I design this scenario to avoid these problems?
Thanks much in advance!