Hi, at my company we plan to use temporal to handle customer order workflows. We are not confident on how to choose a good workflow ID and reuse policy, perhaps someone had a similar experience and a good solution for it.
We have a couple of workflows related to the order, to make it simple, lets take two of them
- ActivateOrder
- TerminateOrder
Our idea is to give our workflows the ID of the order (as suggested in the docs)
We don’t want TerminateOrder and ActivateOrder to run at the same time, so we wan’t to reject workflows with the same ID. However, if for example TerminateOrder fails, we want to be able to re-run the workflow with the same ID, so WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY
seemed like a good policy. But then we realised that we do want to allow a TerminateOrder after a successful ActivateOrder has completed. This will not work, with the current policy.
This then led to us thinking about workflow IDs like TerminateOrder-{WorkflowID} but seems like an ugly solution.
I think the policy we want is to reject workflows with the same ID only if a workflow with the same ID is already running
perhaps this one ?
Greatly appreciate any help with this, love temporal !