Skip to content

Commit afb40a2

Browse files
committed
Refactor worker control protos: separate file and use task tokens
- Move Nexus command payloads to worker_nexus_service_commands.proto - Rename to CancelActivitiesRequestPayload/ResponsePayload - Use task_tokens instead of workflow_execution + scheduled_event_ids - Add file-level documentation for Nexus conventions
1 parent 3fcab46 commit afb40a2

2 files changed

Lines changed: 51 additions & 26 deletions

File tree

temporal/api/worker/v1/message.proto

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -140,29 +140,3 @@ message PluginInfo {
140140
// The version of the plugin, may be empty.
141141
string version = 2;
142142
}
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 create_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-
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
syntax = "proto3";
2+
3+
package temporal.api.worker.v1;
4+
5+
option go_package = "go.temporal.io/api/worker/v1;worker";
6+
option java_package = "io.temporal.api.worker.v1";
7+
option java_multiple_files = true;
8+
option java_outer_classname = "WorkerNexusServiceCommandsProto";
9+
option ruby_package = "Temporalio::Api::Worker::V1";
10+
option csharp_namespace = "Temporalio.Api.Worker.V1";
11+
12+
import "temporal/api/common/v1/message.proto";
13+
14+
// (--
15+
/////////////////////////////////////////////////////////////////////
16+
// This file contains:
17+
// - Conventions between server and worker.
18+
// - Definitions for commands and payloads for server-worker communication via Nexus
19+
//
20+
// COMMUNICATION PROTOCOL:
21+
// - Transport: Nexus tasks on task queue
22+
// - Server identifier: "sys-worker-service"
23+
// - Task queue: /temporal-sys/worker-commands/{namespace}/{worker_grouping_key}
24+
//
25+
// WORKER COMMANDS CONVENTIONS:
26+
//
27+
// - Worker commands are used to manage worker configurations, operations, etc.
28+
// - Command names should match names defined in the server API.
29+
// - Command names are provided in StartOperationRequest.Operation field.
30+
//
31+
// PAYLOAD CONVENTIONS:
32+
//
33+
// - In/out payloads namings follow the same convention as the regular API:
34+
// - CommandNameRequest (input payload)
35+
// - CommandNameResponse (output payload).
36+
// - Empty payload if response is not needed/not expected
37+
//
38+
// --)
39+
40+
// Request payload for the "cancel-activities" Nexus operation.
41+
message CancelActivitiesRequestPayload {
42+
// Task tokens identifying the activities to cancel.
43+
// Each token corresponds to a specific activity task that the worker received.
44+
repeated bytes task_tokens = 1;
45+
}
46+
47+
// Response payload for the "cancel-activities" Nexus operation.
48+
message CancelActivitiesResponsePayload {
49+
// Empty for now. Can be extended to include cancellation status per activity.
50+
}
51+

0 commit comments

Comments
 (0)