Hi, in our scenario we have multiple concurrent API calls (no single instance either) that are related to the same “group”. I wonder if it’s possible to rely on SignalWithStartWorkflow
to create the workflow only once for that group, similar to Postgresql “select for update” or Mongo " db.collection.findOneAndUpdate()".
WorkflowID
will be the same in every such API call.
So SignalWithStartWorkflow
could be a valid solution but I would love to know more about the specific usage before recommending anything. I’m familiar with findOneAndUpdate
but the analogy is sort of not hitting home for me here.
The analogy to findOneAndUpdate is to indicate that Mongo will make sure no 2 or more concurrent update requests will hit the same document at the same time. It is an atomic operation.
Back to our use case, We are exposing an API where there will be multiple calls to create a resource and manage its lifecycle, I want to make sure that only the ONE call creates a new Workflow and all the others will signal that newly created workflow. API calls can “land” on different machines but the workflow should be created once. Like I mentioned previously Workflow ID is the same during the signal regardless of instance origin. So the question is actually this, can Temporal server guarantee a single Workflow creation even if there are multiple concurrent calls to do that.
Yes, Temporal guarantees the uniqueness of workflow by WorkflowID in any situation.
Thanks for the clarifications