Skip to content

Commit ee1d483

Browse files
Quinn-With-Two-Nslong-nt-tran
authored andcommitted
Update callback support -- rebased to master + squashed
Squashed commits: - Add links to request - Add back link on UpdateWorkflowExecutionResponse - Add update trigger - Add WorkflowUpdateOptionsUpdate to WorkflowExecutionOptionsUpdatedEventAttributes - Add request ID - Add new link type - Respond to PR comments
1 parent 8e0453c commit ee1d483

9 files changed

Lines changed: 237 additions & 0 deletions

File tree

openapi/openapiv2.json

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10599,6 +10599,15 @@
1059910599
"type": "object",
1060010600
"description": "Trigger for when the activity is closed."
1060110601
},
10602+
"CallbackInfoUpdateWorkflowExecutionCompleted": {
10603+
"type": "object",
10604+
"properties": {
10605+
"updateId": {
10606+
"type": "string"
10607+
}
10608+
},
10609+
"description": "Trigger for when a workflow update is completed."
10610+
},
1060210611
"CallbackInfoWorkflowClosed": {
1060310612
"type": "object",
1060410613
"description": "Trigger for when the workflow is closed."
@@ -10745,6 +10754,24 @@
1074510754
},
1074610755
"description": "A link to a standalone Nexus operation."
1074710756
},
10757+
"LinkWorkflow": {
10758+
"type": "object",
10759+
"properties": {
10760+
"namespace": {
10761+
"type": "string"
10762+
},
10763+
"workflowId": {
10764+
"type": "string"
10765+
},
10766+
"runId": {
10767+
"type": "string"
10768+
},
10769+
"reason": {
10770+
"$ref": "#/definitions/v1LinkReason"
10771+
}
10772+
},
10773+
"description": "A link to a workflow execution. This is a more general version of WorkflowEvent that doesn't specify a \nparticular event within the workflow, useful when you want to link to a workflow but there is no particular event to link to,\nsuch as a Query or a Rejected Update."
10774+
},
1074810775
"LinkWorkflowEvent": {
1074910776
"type": "object",
1075010777
"properties": {
@@ -11082,6 +11109,27 @@
1108211109
},
1108311110
"description": "RequestIdReference is a indirect reference to a history event through the request ID."
1108411111
},
11112+
"WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate": {
11113+
"type": "object",
11114+
"properties": {
11115+
"updateId": {
11116+
"type": "string",
11117+
"description": "The ID of the workflow update this update options update corresponds to."
11118+
},
11119+
"attachedRequestId": {
11120+
"type": "string",
11121+
"title": "Request ID attached to the running workflow update so that subsequent requests with same\nrequest ID will be deduped"
11122+
},
11123+
"attachedCompletionCallbacks": {
11124+
"type": "array",
11125+
"items": {
11126+
"type": "object",
11127+
"$ref": "#/definitions/v1Callback"
11128+
},
11129+
"description": "Completion callbacks attached to the running workflow update."
11130+
}
11131+
}
11132+
},
1108511133
"WorkflowRuleActionActionActivityPause": {
1108611134
"type": "object"
1108711135
},
@@ -12857,6 +12905,26 @@
1285712905
"description": "The arguments to pass to the named Update handler."
1285812906
}
1285912907
}
12908+
},
12909+
"requestId": {
12910+
"type": "string",
12911+
"description": "The request ID of the request."
12912+
},
12913+
"completionCallbacks": {
12914+
"type": "array",
12915+
"items": {
12916+
"type": "object",
12917+
"$ref": "#/definitions/v1Callback"
12918+
},
12919+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
12920+
},
12921+
"links": {
12922+
"type": "array",
12923+
"items": {
12924+
"type": "object",
12925+
"$ref": "#/definitions/apiCommonV1Link"
12926+
},
12927+
"description": "Links to be associated with this update."
1286012928
}
1286112929
},
1286212930
"description": "The request information that will be delivered all the way down to the\nWorkflow Execution."
@@ -13052,6 +13120,9 @@
1305213120
"properties": {
1305313121
"workflowClosed": {
1305413122
"$ref": "#/definitions/CallbackInfoWorkflowClosed"
13123+
},
13124+
"updateWorkflowExecutionCompleted": {
13125+
"$ref": "#/definitions/CallbackInfoUpdateWorkflowExecutionCompleted"
1305513126
}
1305613127
}
1305713128
},
@@ -15992,10 +16063,23 @@
1599216063
},
1599316064
"nexusOperation": {
1599416065
"$ref": "#/definitions/LinkNexusOperation"
16066+
},
16067+
"workflow": {
16068+
"$ref": "#/definitions/LinkWorkflow"
1599516069
}
1599616070
},
1599716071
"description": "Link can be associated with history events. It might contain information about an external entity\nrelated to the history event. For example, workflow A makes a Nexus call that starts workflow B:\nin this case, a history event in workflow A could contain a Link to the workflow started event in\nworkflow B, and vice-versa."
1599816072
},
16073+
"v1LinkReason": {
16074+
"type": "string",
16075+
"enum": [
16076+
"LINK_REASON_UNSPECIFIED",
16077+
"LINK_REASON_QUERY",
16078+
"LINK_REASON_UPDATE_REJECTED"
16079+
],
16080+
"default": "LINK_REASON_UNSPECIFIED",
16081+
"description": "LinkReason is the reason for linking to a workflow execution."
16082+
},
1599916083
"v1ListActivityExecutionsResponse": {
1600016084
"type": "object",
1600116085
"properties": {
@@ -16454,6 +16538,10 @@
1645416538
"workerCommands": {
1645516539
"type": "boolean",
1645616540
"description": "True if the namespace supports worker commands (server-to-worker communication via control queues)."
16541+
},
16542+
"workflowUpdateCallbacks": {
16543+
"type": "boolean",
16544+
"title": "True if the namespace supports attaching callbacks on workflow updates"
1645716545
}
1645816546
},
1645916547
"description": "Namespace capability details. Should contain what features are enabled in a namespace."
@@ -17905,6 +17993,26 @@
1790517993
},
1790617994
"input": {
1790717995
"$ref": "#/definitions/v1Input"
17996+
},
17997+
"requestId": {
17998+
"type": "string",
17999+
"description": "The request ID of the request."
18000+
},
18001+
"completionCallbacks": {
18002+
"type": "array",
18003+
"items": {
18004+
"type": "object",
18005+
"$ref": "#/definitions/v1Callback"
18006+
},
18007+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
18008+
},
18009+
"links": {
18010+
"type": "array",
18011+
"items": {
18012+
"type": "object",
18013+
"$ref": "#/definitions/v1Link"
18014+
},
18015+
"description": "Links to be associated with this update."
1790818016
}
1790918017
},
1791018018
"description": "The client request that triggers a Workflow Update."
@@ -19672,6 +19780,10 @@
1967219780
"stage": {
1967319781
"$ref": "#/definitions/v1UpdateWorkflowExecutionLifecycleStage",
1967419782
"description": "The most advanced lifecycle stage that the Update is known to have\nreached, where lifecycle stages are ordered\nUPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_UNSPECIFIED <\nUPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED <\nUPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED <\nUPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED.\nUNSPECIFIED will be returned if and only if the server's maximum wait\ntime was reached before the Update reached the stage specified in the\nrequest WaitPolicy, and before the context deadline expired; clients may\nmay then retry the call as needed."
19783+
},
19784+
"link": {
19785+
"$ref": "#/definitions/v1Link",
19786+
"description": "Link to the update event. May be null if the update has not yet been accepted."
1967519787
}
1967619788
}
1967719789
},
@@ -20694,6 +20806,14 @@
2069420806
"timeSkippingConfig": {
2069520807
"$ref": "#/definitions/v1TimeSkippingConfig",
2069620808
"description": "If set, the time-skipping configuration was changed. Contains the full updated configuration."
20809+
},
20810+
"workflowUpdateOptions": {
20811+
"type": "array",
20812+
"items": {
20813+
"type": "object",
20814+
"$ref": "#/definitions/WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate"
20815+
},
20816+
"description": "Updates to workflow updates options."
2069720817
}
2069820818
}
2069920819
},

openapi/openapiv3.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12489,6 +12489,8 @@ components:
1248912489
$ref: '#/components/schemas/Link_Activity'
1249012490
nexusOperation:
1249112491
$ref: '#/components/schemas/Link_NexusOperation'
12492+
workflow:
12493+
$ref: '#/components/schemas/Link_Workflow'
1249212494
description: |-
1249312495
Link can be associated with history events. It might contain information about an external entity
1249412496
related to the history event. For example, workflow A makes a Nexus call that starts workflow B:
@@ -12523,6 +12525,23 @@ components:
1252312525
runId:
1252412526
type: string
1252512527
description: A link to a standalone Nexus operation.
12528+
Link_Workflow:
12529+
type: object
12530+
properties:
12531+
namespace:
12532+
type: string
12533+
workflowId:
12534+
type: string
12535+
runId:
12536+
type: string
12537+
reason:
12538+
enum:
12539+
- LINK_REASON_UNSPECIFIED
12540+
- LINK_REASON_QUERY
12541+
- LINK_REASON_UPDATE_REJECTED
12542+
type: string
12543+
format: enum
12544+
description: "A link to a workflow execution. This is a more general version of WorkflowEvent that doesn't specify a \n particular event within the workflow, useful when you want to link to a workflow but there is no particular event to link to,\n such as a Query or a Rejected Update."
1252612545
Link_WorkflowEvent:
1252712546
type: object
1252812547
properties:
@@ -12924,6 +12943,9 @@ components:
1292412943
workerCommands:
1292512944
type: boolean
1292612945
description: True if the namespace supports worker commands (server-to-worker communication via control queues).
12946+
workflowUpdateCallbacks:
12947+
type: boolean
12948+
description: True if the namespace supports attaching callbacks on workflow updates
1292712949
description: Namespace capability details. Should contain what features are enabled in a namespace.
1292812950
NamespaceInfo_Limits:
1292912951
type: object
@@ -14555,6 +14577,19 @@ components:
1455514577
$ref: '#/components/schemas/Meta'
1455614578
input:
1455714579
$ref: '#/components/schemas/Input'
14580+
requestId:
14581+
type: string
14582+
description: The request ID of the request.
14583+
completionCallbacks:
14584+
type: array
14585+
items:
14586+
$ref: '#/components/schemas/Callback'
14587+
description: Callbacks to be called by the server when this update reaches a terminal state.
14588+
links:
14589+
type: array
14590+
items:
14591+
$ref: '#/components/schemas/Link'
14592+
description: Links to be associated with this update.
1455814593
description: The client request that triggers a Workflow Update.
1455914594
RequestCancelActivityExecutionRequest:
1456014595
type: object
@@ -17930,6 +17965,10 @@ components:
1793017965
request WaitPolicy, and before the context deadline expired; clients may
1793117966
may then retry the call as needed.
1793217967
format: enum
17968+
link:
17969+
allOf:
17970+
- $ref: '#/components/schemas/Link'
17971+
description: Link to the update event. May be null if the update has not yet been accepted.
1793317972
UpsertWorkflowSearchAttributesEventAttributes:
1793417973
type: object
1793517974
properties:
@@ -19274,6 +19313,27 @@ components:
1927419313
allOf:
1927519314
- $ref: '#/components/schemas/TimeSkippingConfig'
1927619315
description: If set, the time-skipping configuration was changed. Contains the full updated configuration.
19316+
workflowUpdateOptions:
19317+
type: array
19318+
items:
19319+
$ref: '#/components/schemas/WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate'
19320+
description: Updates to workflow updates options.
19321+
WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate:
19322+
type: object
19323+
properties:
19324+
updateId:
19325+
type: string
19326+
description: The ID of the workflow update this update options update corresponds to.
19327+
attachedRequestId:
19328+
type: string
19329+
description: |-
19330+
Request ID attached to the running workflow update so that subsequent requests with same
19331+
request ID will be deduped
19332+
attachedCompletionCallbacks:
19333+
type: array
19334+
items:
19335+
$ref: '#/components/schemas/Callback'
19336+
description: Completion callbacks attached to the running workflow update.
1927719337
WorkflowExecutionPauseInfo:
1927819338
type: object
1927919339
properties:

temporal/api/common/v1/message.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import "google/protobuf/empty.proto";
1515
import "temporal/api/enums/v1/common.proto";
1616
import "temporal/api/enums/v1/event_type.proto";
1717
import "temporal/api/enums/v1/reset.proto";
18+
import "temporal/api/enums/v1/link.proto";
1819

1920
message DataBlob {
2021
temporal.api.enums.v1.EncodingType encoding_type = 1;
@@ -254,11 +255,22 @@ message Link {
254255
string run_id = 3;
255256
}
256257

258+
// A link to a workflow execution. This is a more general version of WorkflowEvent that doesn't specify a
259+
// particular event within the workflow, useful when you want to link to a workflow but there is no particular event to link to,
260+
// such as a Query or a Rejected Update.
261+
message Workflow {
262+
string namespace = 1;
263+
string workflow_id = 2;
264+
string run_id = 3;
265+
temporal.api.enums.v1.LinkReason reason = 4;
266+
}
267+
257268
oneof variant {
258269
WorkflowEvent workflow_event = 1;
259270
BatchJob batch_job = 2;
260271
Activity activity = 3;
261272
NexusOperation nexus_operation = 4;
273+
Workflow workflow = 5;
262274
}
263275
}
264276

temporal/api/enums/v1/link.proto

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
syntax = "proto3";
2+
3+
package temporal.api.enums.v1;
4+
5+
option go_package = "go.temporal.io/api/enums/v1;enums";
6+
option java_package = "io.temporal.api.enums.v1";
7+
option java_multiple_files = true;
8+
option java_outer_classname = "LinkProto";
9+
option ruby_package = "Temporalio::Api::Enums::V1";
10+
option csharp_namespace = "Temporalio.Api.Enums.V1";
11+
12+
// LinkReason is the reason for linking to a workflow execution.
13+
enum LinkReason {
14+
LINK_REASON_UNSPECIFIED = 0;
15+
LINK_REASON_QUERY = 1;
16+
LINK_REASON_UPDATE_REJECTED = 2;
17+
}

temporal/api/history/v1/message.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,15 @@ message ChildWorkflowExecutionTerminatedEventAttributes {
881881
}
882882

883883
message WorkflowExecutionOptionsUpdatedEventAttributes {
884+
message WorkflowUpdateOptionsUpdate {
885+
// The ID of the workflow update this update options update corresponds to.
886+
string update_id = 1;
887+
// Request ID attached to the running workflow update so that subsequent requests with same
888+
// request ID will be deduped
889+
string attached_request_id = 2;
890+
// Completion callbacks attached to the running workflow update.
891+
repeated temporal.api.common.v1.Callback attached_completion_callbacks = 3;
892+
}
884893
// Versioning override upserted in this event.
885894
// Ignored if nil or if unset_versioning_override is true.
886895
temporal.api.workflow.v1.VersioningOverride versioning_override = 1;
@@ -898,6 +907,8 @@ message WorkflowExecutionOptionsUpdatedEventAttributes {
898907
temporal.api.common.v1.Priority priority = 6;
899908
// If set, the time-skipping configuration was changed. Contains the full updated configuration.
900909
temporal.api.workflow.v1.TimeSkippingConfig time_skipping_config = 7;
910+
// Updates to workflow updates options.
911+
repeated WorkflowUpdateOptionsUpdate workflow_update_options = 8;
901912
}
902913

903914
// Not used anywhere. Use case is replaced by WorkflowExecutionOptionsUpdatedEventAttributes

temporal/api/namespace/v1/message.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ message NamespaceInfo {
5252
bool poller_autoscaling = 9;
5353
// True if the namespace supports worker commands (server-to-worker communication via control queues).
5454
bool worker_commands = 10;
55+
// True if the namespace supports attaching callbacks on workflow updates
56+
bool workflow_update_callbacks = 11;
5557
}
5658

5759
// Namespace configured limits

temporal/api/update/v1/message.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ message Input {
6262
message Request {
6363
Meta meta = 1;
6464
Input input = 2;
65+
// The request ID of the request.
66+
string request_id = 3;
67+
// Callbacks to be called by the server when this update reaches a terminal state.
68+
repeated temporal.api.common.v1.Callback completion_callbacks = 4;
69+
// Links to be associated with this update.
70+
repeated temporal.api.common.v1.Link links = 5;
6571
}
6672

6773
// An Update protocol message indicating that a Workflow Update has been rejected.

0 commit comments

Comments
 (0)