Skip to content

Commit 6f298e7

Browse files
fretz12Quinn-With-Two-NsSushisource
authored
Add links and callbacks support for standalone activity (#759)
**What changed?** - Added completion_callbacks and links fields to StartActivityExecutionRequest. - Added link field to StartActivityExecutionResponse. - Added callbacks field to DescribeActivityExecutionResponse. - Added links field to ActivityExecutionInfo. - Added new Link.Activity variant to the Link message type. - Added new CallbackInfo base message - Updated OpenAPI v2/v3 specs to reflect the above changes. **Why?** To support links and callbacks for standalone activity executions (SAA), bringing feature parity with workflow-based activity scheduling. --------- Co-authored-by: Quinn Klassen <klassenq@gmail.com> Co-authored-by: Spencer Judge <spencer@temporal.io>
1 parent 67150b1 commit 6f298e7

File tree

7 files changed

+296
-69
lines changed

7 files changed

+296
-69
lines changed

openapi/openapiv2.json

Lines changed: 175 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9041,13 +9041,9 @@
90419041
}
90429042
},
90439043
"definitions": {
9044-
"CallbackInfoTrigger": {
9044+
"CallbackInfoActivityClosed": {
90459045
"type": "object",
9046-
"properties": {
9047-
"workflowClosed": {
9048-
"$ref": "#/definitions/CallbackInfoWorkflowClosed"
9049-
}
9050-
}
9046+
"description": "Trigger for when the activity is closed."
90519047
},
90529048
"CallbackInfoWorkflowClosed": {
90539049
"type": "object",
@@ -9156,6 +9152,21 @@
91569152
},
91579153
"description": "Target a worker polling on a Nexus task queue in a specific namespace."
91589154
},
9155+
"LinkActivity": {
9156+
"type": "object",
9157+
"properties": {
9158+
"namespace": {
9159+
"type": "string"
9160+
},
9161+
"activityId": {
9162+
"type": "string"
9163+
},
9164+
"runId": {
9165+
"type": "string"
9166+
}
9167+
},
9168+
"description": "A link to an activity."
9169+
},
91599170
"LinkBatchJob": {
91609171
"type": "object",
91619172
"properties": {
@@ -10437,6 +10448,22 @@
1043710448
"priority": {
1043810449
"$ref": "#/definitions/v1Priority",
1043910450
"description": "Priority metadata."
10451+
},
10452+
"completionCallbacks": {
10453+
"type": "array",
10454+
"items": {
10455+
"type": "object",
10456+
"$ref": "#/definitions/v1Callback"
10457+
},
10458+
"description": "Callbacks to be called by the server when this activity reaches a terminal state.\nCallback addresses must be whitelisted in the server's dynamic configuration."
10459+
},
10460+
"links": {
10461+
"type": "array",
10462+
"items": {
10463+
"type": "object",
10464+
"$ref": "#/definitions/apiCommonV1Link"
10465+
},
10466+
"description": "Links to be associated with the activity. Callbacks may also have associated links;\nlinks already included with a callback should not be duplicated here."
1044010467
}
1044110468
}
1044210469
},
@@ -11084,6 +11111,123 @@
1108411111
},
1108511112
"description": "Used to validate the compute config without attaching it to a Worker Deployment Version."
1108611113
},
11114+
"apiActivityV1CallbackInfo": {
11115+
"type": "object",
11116+
"properties": {
11117+
"trigger": {
11118+
"$ref": "#/definitions/apiActivityV1CallbackInfoTrigger",
11119+
"description": "Trigger for this callback."
11120+
},
11121+
"info": {
11122+
"$ref": "#/definitions/apiCallbackV1CallbackInfo",
11123+
"description": "Common callback info."
11124+
}
11125+
},
11126+
"description": "CallbackInfo contains the state of an attached activity callback."
11127+
},
11128+
"apiActivityV1CallbackInfoTrigger": {
11129+
"type": "object",
11130+
"properties": {
11131+
"activityClosed": {
11132+
"$ref": "#/definitions/CallbackInfoActivityClosed"
11133+
}
11134+
}
11135+
},
11136+
"apiCallbackV1CallbackInfo": {
11137+
"type": "object",
11138+
"properties": {
11139+
"callback": {
11140+
"$ref": "#/definitions/v1Callback",
11141+
"description": "Information on how this callback should be invoked (e.g. its URL and type)."
11142+
},
11143+
"registrationTime": {
11144+
"type": "string",
11145+
"format": "date-time",
11146+
"description": "The time when the callback was registered."
11147+
},
11148+
"state": {
11149+
"$ref": "#/definitions/v1CallbackState",
11150+
"description": "The current state of the callback."
11151+
},
11152+
"attempt": {
11153+
"type": "integer",
11154+
"format": "int32",
11155+
"description": "The number of attempts made to deliver the callback.\nThis number represents a minimum bound since the attempt is incremented after the callback request completes."
11156+
},
11157+
"lastAttemptCompleteTime": {
11158+
"type": "string",
11159+
"format": "date-time",
11160+
"description": "The time when the last attempt completed."
11161+
},
11162+
"lastAttemptFailure": {
11163+
"$ref": "#/definitions/v1Failure",
11164+
"description": "The last attempt's failure, if any."
11165+
},
11166+
"nextAttemptScheduleTime": {
11167+
"type": "string",
11168+
"format": "date-time",
11169+
"description": "The time when the next attempt is scheduled."
11170+
},
11171+
"blockedReason": {
11172+
"type": "string",
11173+
"description": "If the state is BLOCKED, blocked reason provides additional information."
11174+
}
11175+
},
11176+
"description": "Common callback information. Specific CallbackInfo messages should embed this and may include additional fields."
11177+
},
11178+
"apiWorkflowV1CallbackInfo": {
11179+
"type": "object",
11180+
"properties": {
11181+
"callback": {
11182+
"$ref": "#/definitions/v1Callback",
11183+
"description": "Information on how this callback should be invoked (e.g. its URL and type)."
11184+
},
11185+
"trigger": {
11186+
"$ref": "#/definitions/apiWorkflowV1CallbackInfoTrigger",
11187+
"description": "Trigger for this callback."
11188+
},
11189+
"registrationTime": {
11190+
"type": "string",
11191+
"format": "date-time",
11192+
"description": "The time when the callback was registered."
11193+
},
11194+
"state": {
11195+
"$ref": "#/definitions/v1CallbackState"
11196+
},
11197+
"attempt": {
11198+
"type": "integer",
11199+
"format": "int32",
11200+
"description": "The number of attempts made to deliver the callback.\nThis number represents a minimum bound since the attempt is incremented after the callback request completes."
11201+
},
11202+
"lastAttemptCompleteTime": {
11203+
"type": "string",
11204+
"format": "date-time",
11205+
"description": "The time when the last attempt completed."
11206+
},
11207+
"lastAttemptFailure": {
11208+
"$ref": "#/definitions/v1Failure",
11209+
"description": "The last attempt's failure, if any."
11210+
},
11211+
"nextAttemptScheduleTime": {
11212+
"type": "string",
11213+
"format": "date-time",
11214+
"description": "The time when the next attempt is scheduled."
11215+
},
11216+
"blockedReason": {
11217+
"type": "string",
11218+
"description": "If the state is BLOCKED, blocked reason provides additional information."
11219+
}
11220+
},
11221+
"description": "CallbackInfo contains the state of an attached workflow callback."
11222+
},
11223+
"apiWorkflowV1CallbackInfoTrigger": {
11224+
"type": "object",
11225+
"properties": {
11226+
"workflowClosed": {
11227+
"$ref": "#/definitions/CallbackInfoWorkflowClosed"
11228+
}
11229+
}
11230+
},
1108711231
"protobufAny": {
1108811232
"type": "object",
1108911233
"properties": {
@@ -11249,6 +11393,14 @@
1124911393
"canceledReason": {
1125011394
"type": "string",
1125111395
"description": "Set if activity cancelation was requested."
11396+
},
11397+
"links": {
11398+
"type": "array",
11399+
"items": {
11400+
"type": "object",
11401+
"$ref": "#/definitions/v1Link"
11402+
},
11403+
"description": "Links to related entities, such as the entity that started this activity."
1125211404
}
1125311405
},
1125411406
"description": "Information about a standalone activity."
@@ -12092,51 +12244,6 @@
1209212244
},
1209312245
"description": "Callback to attach to various events in the system, e.g. workflow run completion."
1209412246
},
12095-
"v1CallbackInfo": {
12096-
"type": "object",
12097-
"properties": {
12098-
"callback": {
12099-
"$ref": "#/definitions/v1Callback",
12100-
"description": "Information on how this callback should be invoked (e.g. its URL and type)."
12101-
},
12102-
"trigger": {
12103-
"$ref": "#/definitions/CallbackInfoTrigger",
12104-
"description": "Trigger for this callback."
12105-
},
12106-
"registrationTime": {
12107-
"type": "string",
12108-
"format": "date-time",
12109-
"description": "The time when the callback was registered."
12110-
},
12111-
"state": {
12112-
"$ref": "#/definitions/v1CallbackState"
12113-
},
12114-
"attempt": {
12115-
"type": "integer",
12116-
"format": "int32",
12117-
"description": "The number of attempts made to deliver the callback.\nThis number represents a minimum bound since the attempt is incremented after the callback request completes."
12118-
},
12119-
"lastAttemptCompleteTime": {
12120-
"type": "string",
12121-
"format": "date-time",
12122-
"description": "The time when the last attempt completed."
12123-
},
12124-
"lastAttemptFailure": {
12125-
"$ref": "#/definitions/v1Failure",
12126-
"description": "The last attempt's failure, if any."
12127-
},
12128-
"nextAttemptScheduleTime": {
12129-
"type": "string",
12130-
"format": "date-time",
12131-
"description": "The time when the next attempt is scheduled."
12132-
},
12133-
"blockedReason": {
12134-
"type": "string",
12135-
"description": "If the state is BLOCKED, blocked reason provides additional information."
12136-
}
12137-
},
12138-
"description": "CallbackInfo contains the state of an attached workflow callback."
12139-
},
1214012247
"v1CallbackState": {
1214112248
"type": "string",
1214212249
"enum": [
@@ -12865,6 +12972,14 @@
1286512972
"type": "string",
1286612973
"format": "byte",
1286712974
"description": "Token for follow-on long-poll requests. Absent only if the activity is complete."
12975+
},
12976+
"callbacks": {
12977+
"type": "array",
12978+
"items": {
12979+
"type": "object",
12980+
"$ref": "#/definitions/apiActivityV1CallbackInfo"
12981+
},
12982+
"description": "Callbacks attached to this activity execution and their current state."
1286812983
}
1286912984
}
1287012985
},
@@ -13102,7 +13217,7 @@
1310213217
"type": "array",
1310313218
"items": {
1310413219
"type": "object",
13105-
"$ref": "#/definitions/v1CallbackInfo"
13220+
"$ref": "#/definitions/apiWorkflowV1CallbackInfo"
1310613221
}
1310713222
},
1310813223
"pendingNexusOperations": {
@@ -13684,7 +13799,7 @@
1368413799
"type": "object",
1368513800
"$ref": "#/definitions/v1Link"
1368613801
},
13687-
"description": "Links associated with the event."
13802+
"description": "Links to related entities, such as the entity that started this event's workflow."
1368813803
},
1368913804
"principal": {
1369013805
"$ref": "#/definitions/v1Principal",
@@ -13952,6 +14067,9 @@
1395214067
},
1395314068
"batchJob": {
1395414069
"$ref": "#/definitions/LinkBatchJob"
14070+
},
14071+
"activity": {
14072+
"$ref": "#/definitions/LinkActivity"
1395514073
}
1395614074
},
1395714075
"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."
@@ -16442,6 +16560,10 @@
1644216560
"started": {
1644316561
"type": "boolean",
1644416562
"description": "If true, a new activity was started."
16563+
},
16564+
"link": {
16565+
"$ref": "#/definitions/v1Link",
16566+
"description": "Link to the started activity."
1644516567
}
1644616568
}
1644716569
},

0 commit comments

Comments
 (0)