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..ef14decbd --- /dev/null +++ b/temporal/api/nexusservices/workerservice/v1/request_response.proto @@ -0,0 +1,46 @@ +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"; + +// (-- +// Internal Nexus service for server-to-worker communication. +// See service.yaml for the service definition. +// --) + +// Request payload for the "executeCommands" Nexus operation. +message WorkerCommandsRequest { + repeated WorkerCommand commands = 1; + + message WorkerCommand { + oneof type { + CancelActivity cancel_activity = 1; + } + } + + // Cancel an activity if it is still running. Otherwise, do nothing. + message CancelActivity { + bytes task_token = 1; + } +} + +// Response payload for the "executeCommands" Nexus operation. +message WorkerCommandsResponse { + repeated WorkerCommandResult results = 1; + + message WorkerCommandResult { + oneof type { + CancelActivity cancel_activity = 1; + } + } + + // Treat both successful cancellation and no-op (activity is no longer running) as success. + message CancelActivity { + } +} diff --git a/temporal/api/nexusservices/workerservice/v1/service.yaml b/temporal/api/nexusservices/workerservice/v1/service.yaml new file mode 100644 index 000000000..ad42b3bba --- /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.WorkerCommandsRequest" + $javaRef: "io.temporal.api.nexusservices.workerservice.v1.WorkerCommandsRequest" + $pythonRef: "temporalio.api.nexusservices.workerservice.v1.WorkerCommandsRequest" + $typescriptRef: "@temporalio/api/nexusservices/workerservice/v1.WorkerCommandsRequest" + $dotnetRef: "Temporalio.Api.Nexusservices.Workerservice.V1.WorkerCommandsRequest" + $rubyRef: "Temporalio::Api::Nexusservices::Workerservice::V1::WorkerCommandsRequest" + output: + $goRef: "go.temporal.io/api/nexusservices/workerservice/v1.WorkerCommandsResponse" + $javaRef: "io.temporal.api.nexusservices.workerservice.v1.WorkerCommandsResponse" + $pythonRef: "temporalio.api.nexusservices.workerservice.v1.WorkerCommandsResponse" + $typescriptRef: "@temporalio/api/nexusservices/workerservice/v1.WorkerCommandsResponse" + $dotnetRef: "Temporalio.Api.Nexusservices.Workerservice.V1.WorkerCommandsResponse" + $rubyRef: "Temporalio::Api::Nexusservices::Workerservice::V1::WorkerCommandsResponse" +