Skip to content

Commit f90da86

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 df4181f commit f90da86

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
@@ -9765,6 +9765,15 @@
97659765
"type": "object",
97669766
"description": "Trigger for when the activity is closed."
97679767
},
9768+
"CallbackInfoUpdateWorkflowExecutionCompleted": {
9769+
"type": "object",
9770+
"properties": {
9771+
"updateId": {
9772+
"type": "string"
9773+
}
9774+
},
9775+
"description": "Trigger for when a workflow update is completed."
9776+
},
97689777
"CallbackInfoWorkflowClosed": {
97699778
"type": "object",
97709779
"description": "Trigger for when the workflow is closed."
@@ -9911,6 +9920,24 @@
99119920
},
99129921
"description": "A link to a standalone Nexus operation."
99139922
},
9923+
"LinkWorkflow": {
9924+
"type": "object",
9925+
"properties": {
9926+
"namespace": {
9927+
"type": "string"
9928+
},
9929+
"workflowId": {
9930+
"type": "string"
9931+
},
9932+
"runId": {
9933+
"type": "string"
9934+
},
9935+
"reason": {
9936+
"$ref": "#/definitions/v1LinkReason"
9937+
}
9938+
},
9939+
"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."
9940+
},
99149941
"LinkWorkflowEvent": {
99159942
"type": "object",
99169943
"properties": {
@@ -10248,6 +10275,27 @@
1024810275
},
1024910276
"description": "RequestIdReference is a indirect reference to a history event through the request ID."
1025010277
},
10278+
"WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate": {
10279+
"type": "object",
10280+
"properties": {
10281+
"updateId": {
10282+
"type": "string",
10283+
"description": "The ID of the workflow update this update options update corresponds to."
10284+
},
10285+
"attachedRequestId": {
10286+
"type": "string",
10287+
"title": "Request ID attached to the running workflow update so that subsequent requests with same\nrequest ID will be deduped"
10288+
},
10289+
"attachedCompletionCallbacks": {
10290+
"type": "array",
10291+
"items": {
10292+
"type": "object",
10293+
"$ref": "#/definitions/v1Callback"
10294+
},
10295+
"description": "Completion callbacks attached to the running workflow update."
10296+
}
10297+
}
10298+
},
1025110299
"WorkflowRuleActionActionActivityPause": {
1025210300
"type": "object"
1025310301
},
@@ -11897,6 +11945,26 @@
1189711945
"description": "The arguments to pass to the named Update handler."
1189811946
}
1189911947
}
11948+
},
11949+
"requestId": {
11950+
"type": "string",
11951+
"description": "The request ID of the request."
11952+
},
11953+
"completionCallbacks": {
11954+
"type": "array",
11955+
"items": {
11956+
"type": "object",
11957+
"$ref": "#/definitions/v1Callback"
11958+
},
11959+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
11960+
},
11961+
"links": {
11962+
"type": "array",
11963+
"items": {
11964+
"type": "object",
11965+
"$ref": "#/definitions/apiCommonV1Link"
11966+
},
11967+
"description": "Links to be associated with this update."
1190011968
}
1190111969
},
1190211970
"description": "The request information that will be delivered all the way down to the\nWorkflow Execution."
@@ -12092,6 +12160,9 @@
1209212160
"properties": {
1209312161
"workflowClosed": {
1209412162
"$ref": "#/definitions/CallbackInfoWorkflowClosed"
12163+
},
12164+
"updateWorkflowExecutionCompleted": {
12165+
"$ref": "#/definitions/CallbackInfoUpdateWorkflowExecutionCompleted"
1209512166
}
1209612167
}
1209712168
},
@@ -15032,10 +15103,23 @@
1503215103
},
1503315104
"nexusOperation": {
1503415105
"$ref": "#/definitions/LinkNexusOperation"
15106+
},
15107+
"workflow": {
15108+
"$ref": "#/definitions/LinkWorkflow"
1503515109
}
1503615110
},
1503715111
"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."
1503815112
},
15113+
"v1LinkReason": {
15114+
"type": "string",
15115+
"enum": [
15116+
"LINK_REASON_UNSPECIFIED",
15117+
"LINK_REASON_QUERY",
15118+
"LINK_REASON_UPDATE_REJECTED"
15119+
],
15120+
"default": "LINK_REASON_UNSPECIFIED",
15121+
"description": "LinkReason is the reason for linking to a workflow execution."
15122+
},
1503915123
"v1ListActivityExecutionsResponse": {
1504015124
"type": "object",
1504115125
"properties": {
@@ -15494,6 +15578,10 @@
1549415578
"workerCommands": {
1549515579
"type": "boolean",
1549615580
"description": "True if the namespace supports worker commands (server-to-worker communication via control queues)."
15581+
},
15582+
"workflowUpdateCallbacks": {
15583+
"type": "boolean",
15584+
"title": "True if the namespace supports attaching callbacks on workflow updates"
1549715585
}
1549815586
},
1549915587
"description": "Namespace capability details. Should contain what features are enabled in a namespace."
@@ -16941,6 +17029,26 @@
1694117029
},
1694217030
"input": {
1694317031
"$ref": "#/definitions/v1Input"
17032+
},
17033+
"requestId": {
17034+
"type": "string",
17035+
"description": "The request ID of the request."
17036+
},
17037+
"completionCallbacks": {
17038+
"type": "array",
17039+
"items": {
17040+
"type": "object",
17041+
"$ref": "#/definitions/v1Callback"
17042+
},
17043+
"description": "Callbacks to be called by the server when this update reaches a terminal state."
17044+
},
17045+
"links": {
17046+
"type": "array",
17047+
"items": {
17048+
"type": "object",
17049+
"$ref": "#/definitions/v1Link"
17050+
},
17051+
"description": "Links to be associated with this update."
1694417052
}
1694517053
},
1694617054
"description": "The client request that triggers a Workflow Update."
@@ -18690,6 +18798,10 @@
1869018798
"stage": {
1869118799
"$ref": "#/definitions/v1UpdateWorkflowExecutionLifecycleStage",
1869218800
"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."
18801+
},
18802+
"link": {
18803+
"$ref": "#/definitions/v1Link",
18804+
"description": "Link to the update event. May be null if the update has not yet been accepted."
1869318805
}
1869418806
}
1869518807
},
@@ -19712,6 +19824,14 @@
1971219824
"timeSkippingConfig": {
1971319825
"$ref": "#/definitions/v1TimeSkippingConfig",
1971419826
"description": "If set, the time-skipping configuration was changed. Contains the full updated configuration."
19827+
},
19828+
"workflowUpdateOptions": {
19829+
"type": "array",
19830+
"items": {
19831+
"type": "object",
19832+
"$ref": "#/definitions/WorkflowExecutionOptionsUpdatedEventAttributesWorkflowUpdateOptionsUpdate"
19833+
},
19834+
"description": "Updates to workflow updates options."
1971519835
}
1971619836
}
1971719837
},

openapi/openapiv3.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11663,6 +11663,8 @@ components:
1166311663
$ref: '#/components/schemas/Link_Activity'
1166411664
nexusOperation:
1166511665
$ref: '#/components/schemas/Link_NexusOperation'
11666+
workflow:
11667+
$ref: '#/components/schemas/Link_Workflow'
1166611668
description: |-
1166711669
Link can be associated with history events. It might contain information about an external entity
1166811670
related to the history event. For example, workflow A makes a Nexus call that starts workflow B:
@@ -11697,6 +11699,23 @@ components:
1169711699
runId:
1169811700
type: string
1169911701
description: A link to a standalone Nexus operation.
11702+
Link_Workflow:
11703+
type: object
11704+
properties:
11705+
namespace:
11706+
type: string
11707+
workflowId:
11708+
type: string
11709+
runId:
11710+
type: string
11711+
reason:
11712+
enum:
11713+
- LINK_REASON_UNSPECIFIED
11714+
- LINK_REASON_QUERY
11715+
- LINK_REASON_UPDATE_REJECTED
11716+
type: string
11717+
format: enum
11718+
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."
1170011719
Link_WorkflowEvent:
1170111720
type: object
1170211721
properties:
@@ -12098,6 +12117,9 @@ components:
1209812117
workerCommands:
1209912118
type: boolean
1210012119
description: True if the namespace supports worker commands (server-to-worker communication via control queues).
12120+
workflowUpdateCallbacks:
12121+
type: boolean
12122+
description: True if the namespace supports attaching callbacks on workflow updates
1210112123
description: Namespace capability details. Should contain what features are enabled in a namespace.
1210212124
NamespaceInfo_Limits:
1210312125
type: object
@@ -13692,6 +13714,19 @@ components:
1369213714
$ref: '#/components/schemas/Meta'
1369313715
input:
1369413716
$ref: '#/components/schemas/Input'
13717+
requestId:
13718+
type: string
13719+
description: The request ID of the request.
13720+
completionCallbacks:
13721+
type: array
13722+
items:
13723+
$ref: '#/components/schemas/Callback'
13724+
description: Callbacks to be called by the server when this update reaches a terminal state.
13725+
links:
13726+
type: array
13727+
items:
13728+
$ref: '#/components/schemas/Link'
13729+
description: Links to be associated with this update.
1369513730
description: The client request that triggers a Workflow Update.
1369613731
RequestCancelActivityExecutionRequest:
1369713732
type: object
@@ -16928,6 +16963,10 @@ components:
1692816963
request WaitPolicy, and before the context deadline expired; clients may
1692916964
may then retry the call as needed.
1693016965
format: enum
16966+
link:
16967+
allOf:
16968+
- $ref: '#/components/schemas/Link'
16969+
description: Link to the update event. May be null if the update has not yet been accepted.
1693116970
UpsertWorkflowSearchAttributesEventAttributes:
1693216971
type: object
1693316972
properties:
@@ -18272,6 +18311,27 @@ components:
1827218311
allOf:
1827318312
- $ref: '#/components/schemas/TimeSkippingConfig'
1827418313
description: If set, the time-skipping configuration was changed. Contains the full updated configuration.
18314+
workflowUpdateOptions:
18315+
type: array
18316+
items:
18317+
$ref: '#/components/schemas/WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate'
18318+
description: Updates to workflow updates options.
18319+
WorkflowExecutionOptionsUpdatedEventAttributes_WorkflowUpdateOptionsUpdate:
18320+
type: object
18321+
properties:
18322+
updateId:
18323+
type: string
18324+
description: The ID of the workflow update this update options update corresponds to.
18325+
attachedRequestId:
18326+
type: string
18327+
description: |-
18328+
Request ID attached to the running workflow update so that subsequent requests with same
18329+
request ID will be deduped
18330+
attachedCompletionCallbacks:
18331+
type: array
18332+
items:
18333+
$ref: '#/components/schemas/Callback'
18334+
description: Completion callbacks attached to the running workflow update.
1827518335
WorkflowExecutionPauseInfo:
1827618336
type: object
1827718337
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)