Skip to content

Commit 4b2e0d1

Browse files
committed
Add worker control task protos for activity cancellation
- Add WorkerControlTasks (batch container) and WorkerControlTask to worker/v1/message.proto - Add CancelActivityTask with repeated scheduled_event_ids for flexible cancellation - Add control_queue_name to PollActivityTaskQueueRequest (replaces supports_control_tasks) These fields enable the server to push control messages to workers via their control queue.
1 parent e966760 commit 4b2e0d1

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

temporal/api/worker/v1/message.proto

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ option csharp_namespace = "Temporalio.Api.Worker.V1";
1111

1212
import "google/protobuf/duration.proto";
1313
import "google/protobuf/timestamp.proto";
14+
import "temporal/api/common/v1/message.proto";
1415
import "temporal/api/deployment/v1/message.proto";
1516
import "temporal/api/enums/v1/common.proto";
1617

@@ -139,3 +140,29 @@ message PluginInfo {
139140
// The version of the plugin, may be empty.
140141
string version = 2;
141142
}
143+
144+
// Container for batching multiple control tasks delivered to a worker in one Nexus operation.
145+
message WorkerControlTasks {
146+
repeated WorkerControlTask tasks = 1;
147+
}
148+
149+
// A single control task for a worker.
150+
message WorkerControlTask {
151+
// Timestamp when this task was created.
152+
google.protobuf.Timestamp created_time = 1;
153+
154+
oneof task {
155+
CancelActivityTask cancel_activity = 2;
156+
}
157+
}
158+
159+
// Request to cancel running activities on this worker.
160+
message CancelActivityTask {
161+
// The workflow execution that owns the activities.
162+
temporal.api.common.v1.WorkflowExecution workflow_execution = 1;
163+
// The scheduled event IDs of activities to cancel.
164+
// If empty, cancel all activities for this workflow running on this worker.
165+
repeated int64 scheduled_event_ids = 2;
166+
// Human-readable reason for cancellation.
167+
string reason = 3;
168+
}

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ message PollActivityTaskQueueRequest {
447447
temporal.api.common.v1.WorkerVersionCapabilities worker_version_capabilities = 5 [deprecated = true];
448448
// Worker deployment options that user has set in the worker.
449449
temporal.api.deployment.v1.WorkerDeploymentOptions deployment_options = 6;
450+
451+
// The control queue name for this worker group.
452+
// If non-empty, indicates this worker supports receiving control tasks via the control queue.
453+
// Server constructs the full queue path for pushing control messages (e.g., activity cancellation).
454+
string control_queue_name = 8;
450455
}
451456

452457
message PollActivityTaskQueueResponse {

0 commit comments

Comments
 (0)