From 7a221d761ed5b8e21bd0ce965d4c9a30bbcf0c1b Mon Sep 17 00:00:00 2001 From: rodrigozhou Date: Tue, 14 Jan 2025 17:48:40 -0800 Subject: [PATCH] Add OnConflictOptions to StartWorkflowExecutionRequest --- openapi/openapiv2.json | 32 +++++++++++++++++++ openapi/openapiv3.yaml | 29 +++++++++++++++++ temporal/api/history/v1/message.proto | 5 +++ temporal/api/workflow/v1/message.proto | 8 +++++ .../workflowservice/v1/request_response.proto | 5 +++ 5 files changed, 79 insertions(+) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index b961ba80..e3451689 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -6552,6 +6552,10 @@ "versioningOverride": { "$ref": "#/definitions/v1VersioningOverride", "description": "If set, takes precedence over the Versioning Behavior sent by the SDK on Workflow Task completion.\nTo unset the override after the workflow is running, use UpdateWorkflowExecutionOptions." + }, + "onConflictOptions": { + "$ref": "#/definitions/v1OnConflictOptions", + "description": "It defines behaviors to be executed when the WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING\nconflict policy is used. If set to non-nil object, it will attach the RequestID to the\nexisting running workflow (for deduping), and perform actions specified in the object.\nIf not set (ie., nil value), it won't do anything to the existing running workflow." } } }, @@ -9975,6 +9979,18 @@ }, "description": "Nexus operation timed out." }, + "v1OnConflictOptions": { + "type": "object", + "properties": { + "attachCompletionCallbacks": { + "type": "boolean" + }, + "attachLinks": { + "type": "boolean" + } + }, + "description": "When StartWorkflowExecution uses the WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING conflict policy and\nthere is already an existing running workflow, OnConflictOptions defines actions to be taken on\nthe existing running workflow." + }, "v1Outcome": { "type": "object", "properties": { @@ -12004,6 +12020,10 @@ "versioningOverride": { "$ref": "#/definitions/v1VersioningOverride", "description": "If set, takes precedence over the Versioning Behavior sent by the SDK on Workflow Task completion.\nTo unset the override after the workflow is running, use UpdateWorkflowExecutionOptions." + }, + "onConflictOptions": { + "$ref": "#/definitions/v1OnConflictOptions", + "description": "It defines behaviors to be executed when the WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING\nconflict policy is used. If set to non-nil object, it will attach the RequestID to the\nexisting running workflow (for deduping), and perform actions specified in the object.\nIf not set (ie., nil value), it won't do anything to the existing running workflow." } } }, @@ -13074,6 +13094,18 @@ "versioningOverride": { "$ref": "#/definitions/v1VersioningOverride", "description": "Versioning override in the mutable state after event has been applied." + }, + "attachedRequestId": { + "type": "string", + "description": "Attached request ID to the running workflow execution so that additional requests with same\nrequest ID will be deduped." + }, + "attachedCompletionCallbacks": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1Callback" + }, + "description": "Attached completion callbacks to the running workflow execution." } } }, diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 01547435..aa768df8 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -7443,6 +7443,17 @@ components: type: string description: The request ID allocated at schedule time. description: Nexus operation timed out. + OnConflictOptions: + type: object + properties: + attachCompletionCallbacks: + type: boolean + attachLinks: + type: boolean + description: |- + When StartWorkflowExecution uses the WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING conflict policy and + there is already an existing running workflow, OnConflictOptions defines actions to be taken on + the existing running workflow. Outcome: type: object properties: @@ -9379,6 +9390,14 @@ components: description: |- If set, takes precedence over the Versioning Behavior sent by the SDK on Workflow Task completion. To unset the override after the workflow is running, use UpdateWorkflowExecutionOptions. + onConflictOptions: + allOf: + - $ref: '#/components/schemas/OnConflictOptions' + description: |- + It defines behaviors to be executed when the WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING + conflict policy is used. If set to non-nil object, it will attach the RequestID to the + existing running workflow (for deduping), and perform actions specified in the object. + If not set (ie., nil value), it won't do anything to the existing running workflow. StartWorkflowExecutionResponse: type: object properties: @@ -10570,6 +10589,16 @@ components: allOf: - $ref: '#/components/schemas/VersioningOverride' description: Versioning override in the mutable state after event has been applied. + attachedRequestId: + type: string + description: |- + Attached request ID to the running workflow execution so that additional requests with same + request ID will be deduped. + attachedCompletionCallbacks: + type: array + items: + $ref: '#/components/schemas/Callback' + description: Attached completion callbacks to the running workflow execution. WorkflowExecutionSignaledEventAttributes: type: object properties: diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 065f2bba..8ebcbec1 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -743,6 +743,11 @@ message ChildWorkflowExecutionTerminatedEventAttributes { message WorkflowExecutionOptionsUpdatedEventAttributes { // Versioning override in the mutable state after event has been applied. temporal.api.workflow.v1.VersioningOverride versioning_override = 1; + // Attached request ID to the running workflow execution so that additional requests with same + // request ID will be deduped. + string attached_request_id = 2; + // Attached completion callbacks to the running workflow execution. + repeated temporal.api.common.v1.Callback attached_completion_callbacks = 3; } // Not used anywhere. Use case is replaced by WorkflowExecutionOptionsUpdatedEventAttributes diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index ec5162fa..dfade0a3 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -440,3 +440,11 @@ message VersioningOverride { // Identifies the worker deployment to pin the workflow to. temporal.api.deployment.v1.Deployment deployment = 2; } + +// When StartWorkflowExecution uses the WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING conflict policy and +// there is already an existing running workflow, OnConflictOptions defines actions to be taken on +// the existing running workflow. +message OnConflictOptions { + bool attach_completion_callbacks = 1; + bool attach_links = 2; +} diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index f84e3e2c..5431bdb5 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -206,6 +206,11 @@ message StartWorkflowExecutionRequest { // If set, takes precedence over the Versioning Behavior sent by the SDK on Workflow Task completion. // To unset the override after the workflow is running, use UpdateWorkflowExecutionOptions. temporal.api.workflow.v1.VersioningOverride versioning_override = 25; + // It defines behaviors to be executed when the WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING + // conflict policy is used. If set to non-nil object, it will attach the RequestID to the + // existing running workflow (for deduping), and perform actions specified in the object. + // If not set (ie., nil value), it won't do anything to the existing running workflow. + temporal.api.workflow.v1.OnConflictOptions on_conflict_options = 26; } message StartWorkflowExecutionResponse {