Skip to content

Commit 82a1f2c

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 0460021 commit 82a1f2c

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
@@ -9047,6 +9047,15 @@
90479047
"type": "object",
90489048
"description": "Trigger for when the activity is closed."
90499049
},
9050+
"CallbackInfoUpdateWorkflowExecutionCompleted": {
9051+
"type": "object",
9052+
"properties": {
9053+
"updateId": {
9054+
"type": "string"
9055+
}
9056+
},
9057+
"description": "Trigger for when a workflow update is completed."
9058+
},
90509059
"CallbackInfoWorkflowClosed": {
90519060
"type": "object",
90529061
"description": "Trigger for when the workflow is closed."
@@ -9178,6 +9187,24 @@
91789187
},
91799188
"description": "A link to a built-in batch job.\nBatch jobs can be used to perform operations on a set of workflows (e.g. terminate, signal, cancel, etc).\nThis link can be put on workflow history events generated by actions taken by a batch job."
91809189
},
9190+
"LinkWorkflow": {
9191+
"type": "object",
9192+
"properties": {
9193+
"namespace": {
9194+
"type": "string"
9195+
},
9196+
"workflowId": {
9197+
"type": "string"
9198+
},
9199+
"runId": {
9200+
"type": "string"
9201+
},
9202+
"reason": {
9203+
"$ref": "#/definitions/v1LinkReason"
9204+
}
9205+
},
9206+
"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."
9207+
},
91819208
"LinkWorkflowEvent": {
91829209
"type": "object",
91839210
"properties": {
@@ -9515,6 +9542,27 @@
95159542
},
95169543
"description": "RequestIdReference is a indirect reference to a history event through the request ID."
95179544
},
9545+
"WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate": {
9546+
"type": "object",
9547+
"properties": {
9548+
"updateId": {
9549+
"type": "string",
9550+
"description": "The ID of the workflow update this update options update corresponds to."
9551+
},
9552+
"attachedRequestId": {
9553+
"type": "string",
9554+
"title": "Request ID attached to the running workflow update so that subsequent requests with same\nrequest ID will be deduped"
9555+
},
9556+
"attachedCompletionCallbacks": {
9557+
"type": "array",
9558+
"items": {
9559+
"type": "object",
9560+
"$ref": "#/definitions/v1Callback"
9561+
},
9562+
"description": "Completion callbacks attached to the running workflow update."
9563+
}
9564+
}
9565+
},
95189566
"WorkflowRuleActionActionActivityPause": {
95199567
"type": "object"
95209568
},
@@ -11054,6 +11102,26 @@
1105411102
"description": "The arguments to pass to the named Update handler."
1105511103
}
1105611104
}
11105+
},
11106+
"requestId": {
11107+
"type": "string",
11108+
"description": "The request ID of the request."
11109+
},
11110+
"completionCallbacks": {
11111+
"type": "array",
11112+
"items": {
11113+
"type": "object",
11114+
"$ref": "#/definitions/v1Callback"
11115+
},
11116+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
11117+
},
11118+
"links": {
11119+
"type": "array",
11120+
"items": {
11121+
"type": "object",
11122+
"$ref": "#/definitions/apiCommonV1Link"
11123+
},
11124+
"description": "Links to be associated with this update."
1105711125
}
1105811126
},
1105911127
"description": "The request information that will be delivered all the way down to the\nWorkflow Execution."
@@ -11249,6 +11317,9 @@
1124911317
"properties": {
1125011318
"workflowClosed": {
1125111319
"$ref": "#/definitions/CallbackInfoWorkflowClosed"
11320+
},
11321+
"updateWorkflowExecutionCompleted": {
11322+
"$ref": "#/definitions/CallbackInfoUpdateWorkflowExecutionCompleted"
1125211323
}
1125311324
}
1125411325
},
@@ -14122,10 +14193,23 @@
1412214193
},
1412314194
"activity": {
1412414195
"$ref": "#/definitions/LinkActivity"
14196+
},
14197+
"workflow": {
14198+
"$ref": "#/definitions/LinkWorkflow"
1412514199
}
1412614200
},
1412714201
"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."
1412814202
},
14203+
"v1LinkReason": {
14204+
"type": "string",
14205+
"enum": [
14206+
"LINK_REASON_UNSPECIFIED",
14207+
"LINK_REASON_QUERY",
14208+
"LINK_REASON_UPDATE_REJECTED"
14209+
],
14210+
"default": "LINK_REASON_UNSPECIFIED",
14211+
"description": "LinkReason is the reason for linking to a workflow execution."
14212+
},
1412914213
"v1ListActivityExecutionsResponse": {
1413014214
"type": "object",
1413114215
"properties": {
@@ -14563,6 +14647,10 @@
1456314647
"pollerAutoscaling": {
1456414648
"type": "boolean",
1456514649
"title": "True if the namespace supports poller autoscaling"
14650+
},
14651+
"workflowUpdateCallbacks": {
14652+
"type": "boolean",
14653+
"title": "True if the namespace supports attaching callbacks on workflow updates"
1456614654
}
1456714655
},
1456814656
"description": "Namespace capability details. Should contain what features are enabled in a namespace."
@@ -15717,6 +15805,26 @@
1571715805
},
1571815806
"input": {
1571915807
"$ref": "#/definitions/v1Input"
15808+
},
15809+
"requestId": {
15810+
"type": "string",
15811+
"description": "The request ID of the request."
15812+
},
15813+
"completionCallbacks": {
15814+
"type": "array",
15815+
"items": {
15816+
"type": "object",
15817+
"$ref": "#/definitions/v1Callback"
15818+
},
15819+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
15820+
},
15821+
"links": {
15822+
"type": "array",
15823+
"items": {
15824+
"type": "object",
15825+
"$ref": "#/definitions/v1Link"
15826+
},
15827+
"description": "Links to be associated with this update."
1572015828
}
1572115829
},
1572215830
"description": "The client request that triggers a Workflow Update."
@@ -17448,6 +17556,10 @@
1744817556
"stage": {
1744917557
"$ref": "#/definitions/v1UpdateWorkflowExecutionLifecycleStage",
1745017558
"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."
17559+
},
17560+
"link": {
17561+
"$ref": "#/definitions/v1Link",
17562+
"description": "Link to the update event. May be null if the update has not yet been accepted."
1745117563
}
1745217564
}
1745317565
},
@@ -18470,6 +18582,14 @@
1847018582
"timeSkippingConfig": {
1847118583
"$ref": "#/definitions/v1TimeSkippingConfig",
1847218584
"description": "If set, the time-skipping configuration was changed. Contains the full updated configuration."
18585+
},
18586+
"workflowUpdateOptions": {
18587+
"type": "array",
18588+
"items": {
18589+
"type": "object",
18590+
"$ref": "#/definitions/WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate"
18591+
},
18592+
"description": "Updates to workflow updates options."
1847318593
}
1847418594
}
1847518595
},

openapi/openapiv3.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10946,6 +10946,8 @@ components:
1094610946
$ref: '#/components/schemas/Link_BatchJob'
1094710947
activity:
1094810948
$ref: '#/components/schemas/Link_Activity'
10949+
workflow:
10950+
$ref: '#/components/schemas/Link_Workflow'
1094910951
description: |-
1095010952
Link can be associated with history events. It might contain information about an external entity
1095110953
related to the history event. For example, workflow A makes a Nexus call that starts workflow B:
@@ -10970,6 +10972,23 @@ components:
1097010972
A link to a built-in batch job.
1097110973
Batch jobs can be used to perform operations on a set of workflows (e.g. terminate, signal, cancel, etc).
1097210974
This link can be put on workflow history events generated by actions taken by a batch job.
10975+
Link_Workflow:
10976+
type: object
10977+
properties:
10978+
namespace:
10979+
type: string
10980+
workflowId:
10981+
type: string
10982+
runId:
10983+
type: string
10984+
reason:
10985+
enum:
10986+
- LINK_REASON_UNSPECIFIED
10987+
- LINK_REASON_QUERY
10988+
- LINK_REASON_UPDATE_REJECTED
10989+
type: string
10990+
format: enum
10991+
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."
1097310992
Link_WorkflowEvent:
1097410993
type: object
1097510994
properties:
@@ -11357,6 +11376,9 @@ components:
1135711376
pollerAutoscaling:
1135811377
type: boolean
1135911378
description: True if the namespace supports poller autoscaling
11379+
workflowUpdateCallbacks:
11380+
type: boolean
11381+
description: True if the namespace supports attaching callbacks on workflow updates
1136011382
description: Namespace capability details. Should contain what features are enabled in a namespace.
1136111383
NamespaceInfo_Limits:
1136211384
type: object
@@ -12689,6 +12711,19 @@ components:
1268912711
$ref: '#/components/schemas/Meta'
1269012712
input:
1269112713
$ref: '#/components/schemas/Input'
12714+
requestId:
12715+
type: string
12716+
description: The request ID of the request.
12717+
completionCallbacks:
12718+
type: array
12719+
items:
12720+
$ref: '#/components/schemas/Callback'
12721+
description: Callbacks to be called by the server when this update reaches a terminal state.
12722+
links:
12723+
type: array
12724+
items:
12725+
$ref: '#/components/schemas/Link'
12726+
description: Links to be associated with this update.
1269212727
description: The client request that triggers a Workflow Update.
1269312728
RequestCancelActivityExecutionRequest:
1269412729
type: object
@@ -15774,6 +15809,10 @@ components:
1577415809
request WaitPolicy, and before the context deadline expired; clients may
1577515810
may then retry the call as needed.
1577615811
format: enum
15812+
link:
15813+
allOf:
15814+
- $ref: '#/components/schemas/Link'
15815+
description: Link to the update event. May be null if the update has not yet been accepted.
1577715816
UpsertWorkflowSearchAttributesEventAttributes:
1577815817
type: object
1577915818
properties:
@@ -17115,6 +17154,27 @@ components:
1711517154
allOf:
1711617155
- $ref: '#/components/schemas/TimeSkippingConfig'
1711717156
description: If set, the time-skipping configuration was changed. Contains the full updated configuration.
17157+
workflowUpdateOptions:
17158+
type: array
17159+
items:
17160+
$ref: '#/components/schemas/WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate'
17161+
description: Updates to workflow updates options.
17162+
WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate:
17163+
type: object
17164+
properties:
17165+
updateId:
17166+
type: string
17167+
description: The ID of the workflow update this update options update corresponds to.
17168+
attachedRequestId:
17169+
type: string
17170+
description: |-
17171+
Request ID attached to the running workflow update so that subsequent requests with same
17172+
request ID will be deduped
17173+
attachedCompletionCallbacks:
17174+
type: array
17175+
items:
17176+
$ref: '#/components/schemas/Callback'
17177+
description: Completion callbacks attached to the running workflow update.
1711817178
WorkflowExecutionPauseInfo:
1711917179
type: object
1712017180
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;
@@ -247,10 +248,21 @@ message Link {
247248
string run_id = 3;
248249
}
249250

251+
// A link to a workflow execution. This is a more general version of WorkflowEvent that doesn't specify a
252+
// particular event within the workflow, useful when you want to link to a workflow but there is no particular event to link to,
253+
// such as a Query or a Rejected Update.
254+
message Workflow {
255+
string namespace = 1;
256+
string workflow_id = 2;
257+
string run_id = 3;
258+
temporal.api.enums.v1.LinkReason reason = 4;
259+
}
260+
250261
oneof variant {
251262
WorkflowEvent workflow_event = 1;
252263
BatchJob batch_job = 2;
253264
Activity activity = 3;
265+
Workflow workflow = 4;
254266
}
255267
}
256268

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)