I’m looking for pattern or solution for queueing workflows on some resource.
Simple example:
Worfklow A creates some resource in external system but fails to finish (for whatever reason).
In the meantime Workflow B is started - this one tries to modify the same resource which was created in A.
Possibly there will be also C and D and so on…
I want to queue all and execute them sequentially, so that each new one proceeds only after previous ones finished.
Does temporal support such use case? I use Java sdk.
Not high at all. In fact I do not expect it to be “per second” but rather “per minute” at least for now in my use case. This means that I’d like to protect from race conditions not between “happy path” workflows but in situations when one is stuck with error and the latter should wait until that one succeeds.
The idea is to use a workflow to serialize access to the resource using resource ID as workflow ID. You can implement a workflow to receive signals and call the resource API serially or you can have a special “mutex” workflow that would grant permissions to perform such a call.