Skip to content

Commit 7acb064

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 4087826 commit 7acb064

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
@@ -10585,6 +10585,15 @@
1058510585
"type": "object",
1058610586
"description": "Trigger for when the activity is closed."
1058710587
},
10588+
"CallbackInfoUpdateWorkflowExecutionCompleted": {
10589+
"type": "object",
10590+
"properties": {
10591+
"updateId": {
10592+
"type": "string"
10593+
}
10594+
},
10595+
"description": "Trigger for when a workflow update is completed."
10596+
},
1058810597
"CallbackInfoWorkflowClosed": {
1058910598
"type": "object",
1059010599
"description": "Trigger for when the workflow is closed."
@@ -10731,6 +10740,24 @@
1073110740
},
1073210741
"description": "A link to a standalone Nexus operation."
1073310742
},
10743+
"LinkWorkflow": {
10744+
"type": "object",
10745+
"properties": {
10746+
"namespace": {
10747+
"type": "string"
10748+
},
10749+
"workflowId": {
10750+
"type": "string"
10751+
},
10752+
"runId": {
10753+
"type": "string"
10754+
},
10755+
"reason": {
10756+
"$ref": "#/definitions/v1LinkReason"
10757+
}
10758+
},
10759+
"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."
10760+
},
1073410761
"LinkWorkflowEvent": {
1073510762
"type": "object",
1073610763
"properties": {
@@ -11068,6 +11095,27 @@
1106811095
},
1106911096
"description": "RequestIdReference is a indirect reference to a history event through the request ID."
1107011097
},
11098+
"WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate": {
11099+
"type": "object",
11100+
"properties": {
11101+
"updateId": {
11102+
"type": "string",
11103+
"description": "The ID of the workflow update this update options update corresponds to."
11104+
},
11105+
"attachedRequestId": {
11106+
"type": "string",
11107+
"title": "Request ID attached to the running workflow update so that subsequent requests with same\nrequest ID will be deduped"
11108+
},
11109+
"attachedCompletionCallbacks": {
11110+
"type": "array",
11111+
"items": {
11112+
"type": "object",
11113+
"$ref": "#/definitions/v1Callback"
11114+
},
11115+
"description": "Completion callbacks attached to the running workflow update."
11116+
}
11117+
}
11118+
},
1107111119
"WorkflowRuleActionActionActivityPause": {
1107211120
"type": "object"
1107311121
},
@@ -12843,6 +12891,26 @@
1284312891
"description": "The arguments to pass to the named Update handler."
1284412892
}
1284512893
}
12894+
},
12895+
"requestId": {
12896+
"type": "string",
12897+
"description": "The request ID of the request."
12898+
},
12899+
"completionCallbacks": {
12900+
"type": "array",
12901+
"items": {
12902+
"type": "object",
12903+
"$ref": "#/definitions/v1Callback"
12904+
},
12905+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
12906+
},
12907+
"links": {
12908+
"type": "array",
12909+
"items": {
12910+
"type": "object",
12911+
"$ref": "#/definitions/apiCommonV1Link"
12912+
},
12913+
"description": "Links to be associated with this update."
1284612914
}
1284712915
},
1284812916
"description": "The request information that will be delivered all the way down to the\nWorkflow Execution."
@@ -13038,6 +13106,9 @@
1303813106
"properties": {
1303913107
"workflowClosed": {
1304013108
"$ref": "#/definitions/CallbackInfoWorkflowClosed"
13109+
},
13110+
"updateWorkflowExecutionCompleted": {
13111+
"$ref": "#/definitions/CallbackInfoUpdateWorkflowExecutionCompleted"
1304113112
}
1304213113
}
1304313114
},
@@ -15978,10 +16049,23 @@
1597816049
},
1597916050
"nexusOperation": {
1598016051
"$ref": "#/definitions/LinkNexusOperation"
16052+
},
16053+
"workflow": {
16054+
"$ref": "#/definitions/LinkWorkflow"
1598116055
}
1598216056
},
1598316057
"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."
1598416058
},
16059+
"v1LinkReason": {
16060+
"type": "string",
16061+
"enum": [
16062+
"LINK_REASON_UNSPECIFIED",
16063+
"LINK_REASON_QUERY",
16064+
"LINK_REASON_UPDATE_REJECTED"
16065+
],
16066+
"default": "LINK_REASON_UNSPECIFIED",
16067+
"description": "LinkReason is the reason for linking to a workflow execution."
16068+
},
1598516069
"v1ListActivityExecutionsResponse": {
1598616070
"type": "object",
1598716071
"properties": {
@@ -16440,6 +16524,10 @@
1644016524
"workerCommands": {
1644116525
"type": "boolean",
1644216526
"description": "True if the namespace supports worker commands (server-to-worker communication via control queues)."
16527+
},
16528+
"workflowUpdateCallbacks": {
16529+
"type": "boolean",
16530+
"title": "True if the namespace supports attaching callbacks on workflow updates"
1644316531
}
1644416532
},
1644516533
"description": "Namespace capability details. Should contain what features are enabled in a namespace."
@@ -17891,6 +17979,26 @@
1789117979
},
1789217980
"input": {
1789317981
"$ref": "#/definitions/v1Input"
17982+
},
17983+
"requestId": {
17984+
"type": "string",
17985+
"description": "The request ID of the request."
17986+
},
17987+
"completionCallbacks": {
17988+
"type": "array",
17989+
"items": {
17990+
"type": "object",
17991+
"$ref": "#/definitions/v1Callback"
17992+
},
17993+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
17994+
},
17995+
"links": {
17996+
"type": "array",
17997+
"items": {
17998+
"type": "object",
17999+
"$ref": "#/definitions/v1Link"
18000+
},
18001+
"description": "Links to be associated with this update."
1789418002
}
1789518003
},
1789618004
"description": "The client request that triggers a Workflow Update."
@@ -19658,6 +19766,10 @@
1965819766
"stage": {
1965919767
"$ref": "#/definitions/v1UpdateWorkflowExecutionLifecycleStage",
1966019768
"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."
19769+
},
19770+
"link": {
19771+
"$ref": "#/definitions/v1Link",
19772+
"description": "Link to the update event. May be null if the update has not yet been accepted."
1966119773
}
1966219774
}
1966319775
},
@@ -20680,6 +20792,14 @@
2068020792
"timeSkippingConfig": {
2068120793
"$ref": "#/definitions/v1TimeSkippingConfig",
2068220794
"description": "If set, the time-skipping configuration was changed. Contains the full updated configuration."
20795+
},
20796+
"workflowUpdateOptions": {
20797+
"type": "array",
20798+
"items": {
20799+
"type": "object",
20800+
"$ref": "#/definitions/WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate"
20801+
},
20802+
"description": "Updates to workflow updates options."
2068320803
}
2068420804
}
2068520805
},

openapi/openapiv3.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12475,6 +12475,8 @@ components:
1247512475
$ref: '#/components/schemas/Link_Activity'
1247612476
nexusOperation:
1247712477
$ref: '#/components/schemas/Link_NexusOperation'
12478+
workflow:
12479+
$ref: '#/components/schemas/Link_Workflow'
1247812480
description: |-
1247912481
Link can be associated with history events. It might contain information about an external entity
1248012482
related to the history event. For example, workflow A makes a Nexus call that starts workflow B:
@@ -12509,6 +12511,23 @@ components:
1250912511
runId:
1251012512
type: string
1251112513
description: A link to a standalone Nexus operation.
12514+
Link_Workflow:
12515+
type: object
12516+
properties:
12517+
namespace:
12518+
type: string
12519+
workflowId:
12520+
type: string
12521+
runId:
12522+
type: string
12523+
reason:
12524+
enum:
12525+
- LINK_REASON_UNSPECIFIED
12526+
- LINK_REASON_QUERY
12527+
- LINK_REASON_UPDATE_REJECTED
12528+
type: string
12529+
format: enum
12530+
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."
1251212531
Link_WorkflowEvent:
1251312532
type: object
1251412533
properties:
@@ -12910,6 +12929,9 @@ components:
1291012929
workerCommands:
1291112930
type: boolean
1291212931
description: True if the namespace supports worker commands (server-to-worker communication via control queues).
12932+
workflowUpdateCallbacks:
12933+
type: boolean
12934+
description: True if the namespace supports attaching callbacks on workflow updates
1291312935
description: Namespace capability details. Should contain what features are enabled in a namespace.
1291412936
NamespaceInfo_Limits:
1291512937
type: object
@@ -14541,6 +14563,19 @@ components:
1454114563
$ref: '#/components/schemas/Meta'
1454214564
input:
1454314565
$ref: '#/components/schemas/Input'
14566+
requestId:
14567+
type: string
14568+
description: The request ID of the request.
14569+
completionCallbacks:
14570+
type: array
14571+
items:
14572+
$ref: '#/components/schemas/Callback'
14573+
description: Callbacks to be called by the server when this update reaches a terminal state.
14574+
links:
14575+
type: array
14576+
items:
14577+
$ref: '#/components/schemas/Link'
14578+
description: Links to be associated with this update.
1454414579
description: The client request that triggers a Workflow Update.
1454514580
RequestCancelActivityExecutionRequest:
1454614581
type: object
@@ -17916,6 +17951,10 @@ components:
1791617951
request WaitPolicy, and before the context deadline expired; clients may
1791717952
may then retry the call as needed.
1791817953
format: enum
17954+
link:
17955+
allOf:
17956+
- $ref: '#/components/schemas/Link'
17957+
description: Link to the update event. May be null if the update has not yet been accepted.
1791917958
UpsertWorkflowSearchAttributesEventAttributes:
1792017959
type: object
1792117960
properties:
@@ -19260,6 +19299,27 @@ components:
1926019299
allOf:
1926119300
- $ref: '#/components/schemas/TimeSkippingConfig'
1926219301
description: If set, the time-skipping configuration was changed. Contains the full updated configuration.
19302+
workflowUpdateOptions:
19303+
type: array
19304+
items:
19305+
$ref: '#/components/schemas/WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate'
19306+
description: Updates to workflow updates options.
19307+
WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate:
19308+
type: object
19309+
properties:
19310+
updateId:
19311+
type: string
19312+
description: The ID of the workflow update this update options update corresponds to.
19313+
attachedRequestId:
19314+
type: string
19315+
description: |-
19316+
Request ID attached to the running workflow update so that subsequent requests with same
19317+
request ID will be deduped
19318+
attachedCompletionCallbacks:
19319+
type: array
19320+
items:
19321+
$ref: '#/components/schemas/Callback'
19322+
description: Completion callbacks attached to the running workflow update.
1926319323
WorkflowExecutionPauseInfo:
1926419324
type: object
1926519325
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)