temporalio / api

Temporal gRPC API and proto files
https://temporal.io
MIT License
83 stars 66 forks source link

Add WorkflowIdConflictPolicy #359

Closed stephanos closed 6 months ago

stephanos commented 7 months ago

What changed?

Introducing the WorkflowIdConflictPolicy enum to define the dedup behavior of Start Workflow for a running workflow - and solidifying the WorkflowIdReusePolicy as the dedup behavior for closed workflows.

NOTE: Terminate-If-Running will be deprecated once all API, Server and SDK changes have been merged since otherwise users wouldn't be able to use the new enum but see a deprecation notice already.

Implementations:

Why?

This is in preparation for Update-With-Start; so that the user can indicate that an already-running Workflow is not a failure. By adding this conflict resolution mechanism directly to Start Workflow itself, it allows to combine arbitrary operations, such as Update and Signal, with Start - instead of requiring hard-coded top-level APIs like Signal-With-Start.

Without the new enum, the Server wouldn't know whether the user requested a "Maybe Start" (ie continue when Start failed because of another running Workflow with the same ID) or a "Require Start" (ie stop when Start failed because of another running Workflow with the same ID).

Breaking changes

cretz commented 7 months ago

(I have avoided this PR because it is not marked ready for review, but let me know if we should review anyways)

stephanos commented 7 months ago

@cretz I was going to open the PR for review once I implemented the Server implementation, as I understand that's minimum requirement to get API changes merged. Having said that, I don't mind getting feedback now.

stephanos commented 6 months ago

I just pushed another set of changes to StartWorkflowExecutionResponse and SignalWithStartWorkflowExecutionResponse. It now includes details about what action(s) were actually taken by the operation.

I'd appreciate another review of that new addition.