Skip to content

Commit fe9a5c6

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 f1e7757 commit fe9a5c6

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
@@ -9751,6 +9751,15 @@
97519751
"type": "object",
97529752
"description": "Trigger for when the activity is closed."
97539753
},
9754+
"CallbackInfoUpdateWorkflowExecutionCompleted": {
9755+
"type": "object",
9756+
"properties": {
9757+
"updateId": {
9758+
"type": "string"
9759+
}
9760+
},
9761+
"description": "Trigger for when a workflow update is completed."
9762+
},
97549763
"CallbackInfoWorkflowClosed": {
97559764
"type": "object",
97569765
"description": "Trigger for when the workflow is closed."
@@ -9897,6 +9906,24 @@
98979906
},
98989907
"description": "A link to a standalone Nexus operation."
98999908
},
9909+
"LinkWorkflow": {
9910+
"type": "object",
9911+
"properties": {
9912+
"namespace": {
9913+
"type": "string"
9914+
},
9915+
"workflowId": {
9916+
"type": "string"
9917+
},
9918+
"runId": {
9919+
"type": "string"
9920+
},
9921+
"reason": {
9922+
"$ref": "#/definitions/v1LinkReason"
9923+
}
9924+
},
9925+
"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."
9926+
},
99009927
"LinkWorkflowEvent": {
99019928
"type": "object",
99029929
"properties": {
@@ -10234,6 +10261,27 @@
1023410261
},
1023510262
"description": "RequestIdReference is a indirect reference to a history event through the request ID."
1023610263
},
10264+
"WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate": {
10265+
"type": "object",
10266+
"properties": {
10267+
"updateId": {
10268+
"type": "string",
10269+
"description": "The ID of the workflow update this update options update corresponds to."
10270+
},
10271+
"attachedRequestId": {
10272+
"type": "string",
10273+
"title": "Request ID attached to the running workflow update so that subsequent requests with same\nrequest ID will be deduped"
10274+
},
10275+
"attachedCompletionCallbacks": {
10276+
"type": "array",
10277+
"items": {
10278+
"type": "object",
10279+
"$ref": "#/definitions/v1Callback"
10280+
},
10281+
"description": "Completion callbacks attached to the running workflow update."
10282+
}
10283+
}
10284+
},
1023710285
"WorkflowRuleActionActionActivityPause": {
1023810286
"type": "object"
1023910287
},
@@ -11883,6 +11931,26 @@
1188311931
"description": "The arguments to pass to the named Update handler."
1188411932
}
1188511933
}
11934+
},
11935+
"requestId": {
11936+
"type": "string",
11937+
"description": "The request ID of the request."
11938+
},
11939+
"completionCallbacks": {
11940+
"type": "array",
11941+
"items": {
11942+
"type": "object",
11943+
"$ref": "#/definitions/v1Callback"
11944+
},
11945+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
11946+
},
11947+
"links": {
11948+
"type": "array",
11949+
"items": {
11950+
"type": "object",
11951+
"$ref": "#/definitions/apiCommonV1Link"
11952+
},
11953+
"description": "Links to be associated with this update."
1188611954
}
1188711955
},
1188811956
"description": "The request information that will be delivered all the way down to the\nWorkflow Execution."
@@ -12078,6 +12146,9 @@
1207812146
"properties": {
1207912147
"workflowClosed": {
1208012148
"$ref": "#/definitions/CallbackInfoWorkflowClosed"
12149+
},
12150+
"updateWorkflowExecutionCompleted": {
12151+
"$ref": "#/definitions/CallbackInfoUpdateWorkflowExecutionCompleted"
1208112152
}
1208212153
}
1208312154
},
@@ -15018,10 +15089,23 @@
1501815089
},
1501915090
"nexusOperation": {
1502015091
"$ref": "#/definitions/LinkNexusOperation"
15092+
},
15093+
"workflow": {
15094+
"$ref": "#/definitions/LinkWorkflow"
1502115095
}
1502215096
},
1502315097
"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."
1502415098
},
15099+
"v1LinkReason": {
15100+
"type": "string",
15101+
"enum": [
15102+
"LINK_REASON_UNSPECIFIED",
15103+
"LINK_REASON_QUERY",
15104+
"LINK_REASON_UPDATE_REJECTED"
15105+
],
15106+
"default": "LINK_REASON_UNSPECIFIED",
15107+
"description": "LinkReason is the reason for linking to a workflow execution."
15108+
},
1502515109
"v1ListActivityExecutionsResponse": {
1502615110
"type": "object",
1502715111
"properties": {
@@ -15480,6 +15564,10 @@
1548015564
"workerCommands": {
1548115565
"type": "boolean",
1548215566
"description": "True if the namespace supports worker commands (server-to-worker communication via control queues)."
15567+
},
15568+
"workflowUpdateCallbacks": {
15569+
"type": "boolean",
15570+
"title": "True if the namespace supports attaching callbacks on workflow updates"
1548315571
}
1548415572
},
1548515573
"description": "Namespace capability details. Should contain what features are enabled in a namespace."
@@ -16927,6 +17015,26 @@
1692717015
},
1692817016
"input": {
1692917017
"$ref": "#/definitions/v1Input"
17018+
},
17019+
"requestId": {
17020+
"type": "string",
17021+
"description": "The request ID of the request."
17022+
},
17023+
"completionCallbacks": {
17024+
"type": "array",
17025+
"items": {
17026+
"type": "object",
17027+
"$ref": "#/definitions/v1Callback"
17028+
},
17029+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
17030+
},
17031+
"links": {
17032+
"type": "array",
17033+
"items": {
17034+
"type": "object",
17035+
"$ref": "#/definitions/v1Link"
17036+
},
17037+
"description": "Links to be associated with this update."
1693017038
}
1693117039
},
1693217040
"description": "The client request that triggers a Workflow Update."
@@ -18676,6 +18784,10 @@
1867618784
"stage": {
1867718785
"$ref": "#/definitions/v1UpdateWorkflowExecutionLifecycleStage",
1867818786
"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."
18787+
},
18788+
"link": {
18789+
"$ref": "#/definitions/v1Link",
18790+
"description": "Link to the update event. May be null if the update has not yet been accepted."
1867918791
}
1868018792
}
1868118793
},
@@ -19698,6 +19810,14 @@
1969819810
"timeSkippingConfig": {
1969919811
"$ref": "#/definitions/v1TimeSkippingConfig",
1970019812
"description": "If set, the time-skipping configuration was changed. Contains the full updated configuration."
19813+
},
19814+
"workflowUpdateOptions": {
19815+
"type": "array",
19816+
"items": {
19817+
"type": "object",
19818+
"$ref": "#/definitions/WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate"
19819+
},
19820+
"description": "Updates to workflow updates options."
1970119821
}
1970219822
}
1970319823
},

openapi/openapiv3.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11645,6 +11645,8 @@ components:
1164511645
$ref: '#/components/schemas/Link_Activity'
1164611646
nexusOperation:
1164711647
$ref: '#/components/schemas/Link_NexusOperation'
11648+
workflow:
11649+
$ref: '#/components/schemas/Link_Workflow'
1164811650
description: |-
1164911651
Link can be associated with history events. It might contain information about an external entity
1165011652
related to the history event. For example, workflow A makes a Nexus call that starts workflow B:
@@ -11679,6 +11681,23 @@ components:
1167911681
runId:
1168011682
type: string
1168111683
description: A link to a standalone Nexus operation.
11684+
Link_Workflow:
11685+
type: object
11686+
properties:
11687+
namespace:
11688+
type: string
11689+
workflowId:
11690+
type: string
11691+
runId:
11692+
type: string
11693+
reason:
11694+
enum:
11695+
- LINK_REASON_UNSPECIFIED
11696+
- LINK_REASON_QUERY
11697+
- LINK_REASON_UPDATE_REJECTED
11698+
type: string
11699+
format: enum
11700+
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."
1168211701
Link_WorkflowEvent:
1168311702
type: object
1168411703
properties:
@@ -12080,6 +12099,9 @@ components:
1208012099
workerCommands:
1208112100
type: boolean
1208212101
description: True if the namespace supports worker commands (server-to-worker communication via control queues).
12102+
workflowUpdateCallbacks:
12103+
type: boolean
12104+
description: True if the namespace supports attaching callbacks on workflow updates
1208312105
description: Namespace capability details. Should contain what features are enabled in a namespace.
1208412106
NamespaceInfo_Limits:
1208512107
type: object
@@ -13674,6 +13696,19 @@ components:
1367413696
$ref: '#/components/schemas/Meta'
1367513697
input:
1367613698
$ref: '#/components/schemas/Input'
13699+
requestId:
13700+
type: string
13701+
description: The request ID of the request.
13702+
completionCallbacks:
13703+
type: array
13704+
items:
13705+
$ref: '#/components/schemas/Callback'
13706+
description: Callbacks to be called by the server when this update reaches a terminal state.
13707+
links:
13708+
type: array
13709+
items:
13710+
$ref: '#/components/schemas/Link'
13711+
description: Links to be associated with this update.
1367713712
description: The client request that triggers a Workflow Update.
1367813713
RequestCancelActivityExecutionRequest:
1367913714
type: object
@@ -16910,6 +16945,10 @@ components:
1691016945
request WaitPolicy, and before the context deadline expired; clients may
1691116946
may then retry the call as needed.
1691216947
format: enum
16948+
link:
16949+
allOf:
16950+
- $ref: '#/components/schemas/Link'
16951+
description: Link to the update event. May be null if the update has not yet been accepted.
1691316952
UpsertWorkflowSearchAttributesEventAttributes:
1691416953
type: object
1691516954
properties:
@@ -18254,6 +18293,27 @@ components:
1825418293
allOf:
1825518294
- $ref: '#/components/schemas/TimeSkippingConfig'
1825618295
description: If set, the time-skipping configuration was changed. Contains the full updated configuration.
18296+
workflowUpdateOptions:
18297+
type: array
18298+
items:
18299+
$ref: '#/components/schemas/WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate'
18300+
description: Updates to workflow updates options.
18301+
WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate:
18302+
type: object
18303+
properties:
18304+
updateId:
18305+
type: string
18306+
description: The ID of the workflow update this update options update corresponds to.
18307+
attachedRequestId:
18308+
type: string
18309+
description: |-
18310+
Request ID attached to the running workflow update so that subsequent requests with same
18311+
request ID will be deduped
18312+
attachedCompletionCallbacks:
18313+
type: array
18314+
items:
18315+
$ref: '#/components/schemas/Callback'
18316+
description: Completion callbacks attached to the running workflow update.
1825718317
WorkflowExecutionPauseInfo:
1825818318
type: object
1825918319
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)