We have a setup where we have multiple process definitions deployed on the same process engine.
These processes are having many steps of type External task mostly.
Now our requirement is like we want asynchronous communication in External Task.
For Example - External task name validateCredentials can give response after an undefined time for the processInstance. But as the external task requires a lock duration which makes its behavior synchronous.
So I had tried for a bigger lock duration in external Task. But that is failing as service response time is not in my hand.
So I am trying for an additional step ReceiveTask type in my process which will get triggered when an external task service response is ready.
But Receive Task uses a messageName for triggering.
As the multiple process can have same external task and it’s next Receive Task is having different messageName, so it is hard for me to hard code messageName in my code.
Is there any suggestion for this problem?
Is there any best practice for asynchronus communication for external task?
Any example or code snippet will be highly appreciated.
The best thing to do would be to have the service you used to lock the external extend the lock periodically. Then it’ll stay locked as long as the service is alive.
Because I have to maintain a scheduler having the duration of a task lock, when this time elapse almost around 80% I have to extend the lock duration everytime.
I am having 1 more use case in which external worker is saying they will update the process instance back when their processing will get complete. They want to continous consume the process instance and update them as and when their business logic gets completed means asynchronously.
For Example - we have an external task (validateItemInInventory) this external task call multiple services(in multiple threads) internally to validate an item in inventory.
So the owner of this external task asked me to do something like send all the processInstance as and when it is getting created.
They will return the reponse one by one or in bulk either via processInstanceId or via some correlation key variables.