Skip to content

Commit 28ea1dd

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 cc64b73 commit 28ea1dd

2 files changed

Lines changed: 49 additions & 27 deletions

File tree

temporal/api/worker/v1/message.proto

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ 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";
1514
import "temporal/api/deployment/v1/message.proto";
1615
import "temporal/api/enums/v1/common.proto";
1716

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

0 commit comments

Comments
 (0)