diff --git a/temporal/api/nexusservices/workerservice/v1/request_response.proto b/temporal/api/nexusservices/workerservice/v1/request_response.proto new file mode 100644 index 000000000..0daa67b64 --- /dev/null +++ b/temporal/api/nexusservices/workerservice/v1/request_response.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package temporal.api.nexusservices.workerservice.v1; + +option go_package = "go.temporal.io/api/nexusservices/workerservice/v1;workerservice"; +option java_package = "io.temporal.api.nexusservices.workerservice.v1"; +option java_multiple_files = true; +option java_outer_classname = "RequestResponseProto"; +option ruby_package = "Temporalio::Api::Nexusservices::Workerservice::V1"; +option csharp_namespace = "Temporalio.Api.Nexusservices.Workerservice.V1"; + +import "temporal/api/worker/v1/message.proto"; + +// (-- +// Internal Nexus service for server-to-worker communication. +// See service.yaml for the service definition. +// --) + +// Request payload for the "ExecuteCommands" Nexus operation. +message ExecuteCommandsRequest { + repeated temporal.api.worker.v1.WorkerCommand commands = 1; +} + +// Response payload for the "ExecuteCommands" Nexus operation. +// The results list must be 1:1 with the commands list in the request (same size and order). +message ExecuteCommandsResponse { + repeated temporal.api.worker.v1.WorkerCommandResult results = 1; +} diff --git a/temporal/api/nexusservices/workerservice/v1/service.yaml b/temporal/api/nexusservices/workerservice/v1/service.yaml new file mode 100644 index 000000000..cb49cb118 --- /dev/null +++ b/temporal/api/nexusservices/workerservice/v1/service.yaml @@ -0,0 +1,32 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nexus-rpc/nexus-rpc-gen/main/schemas/nexus-rpc-gen.json +# +# Nexus service definition for server-to-worker communication. +# See request_response.proto for message definitions. +# +# Task queue format: /temporal-sys/worker-commands/{namespace}/{worker_grouping_key} + +nexusrpc: 1.0.0 + +services: + temporal.api.nexusservices.workerservice.v1.WorkerService: + description: > + Internal Nexus service for server-to-worker communication. + Used by the Temporal server to send commands to workers. + operations: + ExecuteCommands: + description: Executes worker commands sent by the server. + input: + $goRef: "go.temporal.io/api/nexusservices/workerservice/v1.ExecuteCommandsRequest" + $javaRef: "io.temporal.api.nexusservices.workerservice.v1.ExecuteCommandsRequest" + $pythonRef: "temporalio.api.nexusservices.workerservice.v1.ExecuteCommandsRequest" + $typescriptRef: "@temporalio/api/nexusservices/workerservice/v1.ExecuteCommandsRequest" + $dotnetRef: "Temporalio.Api.Nexusservices.Workerservice.V1.ExecuteCommandsRequest" + $rubyRef: "Temporalio::Api::Nexusservices::Workerservice::V1::ExecuteCommandsRequest" + output: + $goRef: "go.temporal.io/api/nexusservices/workerservice/v1.ExecuteCommandsResponse" + $javaRef: "io.temporal.api.nexusservices.workerservice.v1.ExecuteCommandsResponse" + $pythonRef: "temporalio.api.nexusservices.workerservice.v1.ExecuteCommandsResponse" + $typescriptRef: "@temporalio/api/nexusservices/workerservice/v1.ExecuteCommandsResponse" + $dotnetRef: "Temporalio.Api.Nexusservices.Workerservice.V1.ExecuteCommandsResponse" + $rubyRef: "Temporalio::Api::Nexusservices::Workerservice::V1::ExecuteCommandsResponse" + diff --git a/temporal/api/worker/v1/message.proto b/temporal/api/worker/v1/message.proto index b65faeb29..a87142c78 100644 --- a/temporal/api/worker/v1/message.proto +++ b/temporal/api/worker/v1/message.proto @@ -193,3 +193,27 @@ message StorageDriverInfo { // The type of the driver, required. string type = 1; } + +// A command sent from the server to a worker. +message WorkerCommand { + oneof type { + CancelActivityCommand cancel_activity = 1; + } +} + +// Cancel an activity if it is still running. Otherwise, do nothing. +message CancelActivityCommand { + bytes task_token = 1; +} + +// The result of executing a WorkerCommand. +message WorkerCommandResult { + oneof type { + CancelActivityResult cancel_activity = 1; + } +} + +// Result of a CancelActivityCommand. +// Treat both successful cancellation and no-op (activity is no longer running) as success. +message CancelActivityResult { +}