Skip to content

Commit c295291

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 3a30adc commit c295291

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": {
@@ -15476,6 +15560,10 @@
1547615560
"pollerAutoscaling": {
1547715561
"type": "boolean",
1547815562
"title": "True if the namespace supports poller autoscaling"
15563+
},
15564+
"workflowUpdateCallbacks": {
15565+
"type": "boolean",
15566+
"title": "True if the namespace supports attaching callbacks on workflow updates"
1547915567
}
1548015568
},
1548115569
"description": "Namespace capability details. Should contain what features are enabled in a namespace."
@@ -16923,6 +17011,26 @@
1692317011
},
1692417012
"input": {
1692517013
"$ref": "#/definitions/v1Input"
17014+
},
17015+
"requestId": {
17016+
"type": "string",
17017+
"description": "The request ID of the request."
17018+
},
17019+
"completionCallbacks": {
17020+
"type": "array",
17021+
"items": {
17022+
"type": "object",
17023+
"$ref": "#/definitions/v1Callback"
17024+
},
17025+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
17026+
},
17027+
"links": {
17028+
"type": "array",
17029+
"items": {
17030+
"type": "object",
17031+
"$ref": "#/definitions/v1Link"
17032+
},
17033+
"description": "Links to be associated with this update."
1692617034
}
1692717035
},
1692817036
"description": "The client request that triggers a Workflow Update."
@@ -18673,6 +18781,10 @@
1867318781
"stage": {
1867418782
"$ref": "#/definitions/v1UpdateWorkflowExecutionLifecycleStage",
1867518783
"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."
18784+
},
18785+
"link": {
18786+
"$ref": "#/definitions/v1Link",
18787+
"description": "Link to the update event. May be null if the update has not yet been accepted."
1867618788
}
1867718789
}
1867818790
},
@@ -19695,6 +19807,14 @@
1969519807
"timeSkippingConfig": {
1969619808
"$ref": "#/definitions/v1TimeSkippingConfig",
1969719809
"description": "If set, the time-skipping configuration was changed. Contains the full updated configuration."
19810+
},
19811+
"workflowUpdateOptions": {
19812+
"type": "array",
19813+
"items": {
19814+
"type": "object",
19815+
"$ref": "#/definitions/WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate"
19816+
},
19817+
"description": "Updates to workflow updates options."
1969819818
}
1969919819
}
1970019820
},

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:
@@ -12077,6 +12096,9 @@ components:
1207712096
pollerAutoscaling:
1207812097
type: boolean
1207912098
description: True if the namespace supports poller autoscaling
12099+
workflowUpdateCallbacks:
12100+
type: boolean
12101+
description: True if the namespace supports attaching callbacks on workflow updates
1208012102
description: Namespace capability details. Should contain what features are enabled in a namespace.
1208112103
NamespaceInfo_Limits:
1208212104
type: object
@@ -13671,6 +13693,19 @@ components:
1367113693
$ref: '#/components/schemas/Meta'
1367213694
input:
1367313695
$ref: '#/components/schemas/Input'
13696+
requestId:
13697+
type: string
13698+
description: The request ID of the request.
13699+
completionCallbacks:
13700+
type: array
13701+
items:
13702+
$ref: '#/components/schemas/Callback'
13703+
description: Callbacks to be called by the server when this update reaches a terminal state.
13704+
links:
13705+
type: array
13706+
items:
13707+
$ref: '#/components/schemas/Link'
13708+
description: Links to be associated with this update.
1367413709
description: The client request that triggers a Workflow Update.
1367513710
RequestCancelActivityExecutionRequest:
1367613711
type: object
@@ -16914,6 +16949,10 @@ components:
1691416949
request WaitPolicy, and before the context deadline expired; clients may
1691516950
may then retry the call as needed.
1691616951
format: enum
16952+
link:
16953+
allOf:
16954+
- $ref: '#/components/schemas/Link'
16955+
description: Link to the update event. May be null if the update has not yet been accepted.
1691716956
UpsertWorkflowSearchAttributesEventAttributes:
1691816957
type: object
1691916958
properties:
@@ -18255,6 +18294,27 @@ components:
1825518294
allOf:
1825618295
- $ref: '#/components/schemas/TimeSkippingConfig'
1825718296
description: If set, the time-skipping configuration was changed. Contains the full updated configuration.
18297+
workflowUpdateOptions:
18298+
type: array
18299+
items:
18300+
$ref: '#/components/schemas/WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate'
18301+
description: Updates to workflow updates options.
18302+
WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate:
18303+
type: object
18304+
properties:
18305+
updateId:
18306+
type: string
18307+
description: The ID of the workflow update this update options update corresponds to.
18308+
attachedRequestId:
18309+
type: string
18310+
description: |-
18311+
Request ID attached to the running workflow update so that subsequent requests with same
18312+
request ID will be deduped
18313+
attachedCompletionCallbacks:
18314+
type: array
18315+
items:
18316+
$ref: '#/components/schemas/Callback'
18317+
description: Completion callbacks attached to the running workflow update.
1825818318
WorkflowExecutionPauseInfo:
1825918319
type: object
1826018320
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
@@ -871,6 +871,15 @@ message ChildWorkflowExecutionTerminatedEventAttributes {
871871
}
872872

873873
message WorkflowExecutionOptionsUpdatedEventAttributes {
874+
message WorkflowUpdateOptionsUpdate {
875+
// The ID of the workflow update this update options update corresponds to.
876+
string update_id = 1;
877+
// Request ID attached to the running workflow update so that subsequent requests with same
878+
// request ID will be deduped
879+
string attached_request_id = 2;
880+
// Completion callbacks attached to the running workflow update.
881+
repeated temporal.api.common.v1.Callback attached_completion_callbacks = 3;
882+
}
874883
// Versioning override upserted in this event.
875884
// Ignored if nil or if unset_versioning_override is true.
876885
temporal.api.workflow.v1.VersioningOverride versioning_override = 1;
@@ -888,6 +897,8 @@ message WorkflowExecutionOptionsUpdatedEventAttributes {
888897
temporal.api.common.v1.Priority priority = 6;
889898
// If set, the time-skipping configuration was changed. Contains the full updated configuration.
890899
temporal.api.workflow.v1.TimeSkippingConfig time_skipping_config = 7;
900+
// Updates to workflow updates options.
901+
repeated WorkflowUpdateOptionsUpdate workflow_update_options = 8;
891902
}
892903

893904
// 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
@@ -50,6 +50,8 @@ message NamespaceInfo {
5050
bool worker_poll_complete_on_shutdown = 8;
5151
// True if the namespace supports poller autoscaling
5252
bool poller_autoscaling = 9;
53+
// True if the namespace supports attaching callbacks on workflow updates
54+
bool workflow_update_callbacks = 10;
5355
}
5456

5557
// 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)