diff --git a/temporal/api/command/v1/message.proto b/temporal/api/command/v1/message.proto index ee839115b..b8be64315 100644 --- a/temporal/api/command/v1/message.proto +++ b/temporal/api/command/v1/message.proto @@ -16,6 +16,7 @@ import "temporal/api/enums/v1/command_type.proto"; import "temporal/api/common/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; +import "temporal/api/session/v1/message.proto"; import "temporal/api/workflow/v1/message.proto"; import "temporal/api/sdk/v1/user_metadata.proto"; import "temporal/api/sdk/v1/event_group_marker.proto"; @@ -68,6 +69,8 @@ message ScheduleActivityTaskCommandAttributes { // Priority metadata. If this message is not present, or any fields are not // present, they inherit the values from the workflow. temporal.api.common.v1.Priority priority = 14; + + temporal.api.session.v1.ActivitySessionOptions session_options = 15; } message RequestCancelActivityTaskCommandAttributes { diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 1c6efd305..8f5a233bf 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -20,6 +20,7 @@ import "temporal/api/common/v1/message.proto"; import "temporal/api/deployment/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; import "temporal/api/nexus/v1/message.proto"; +import "temporal/api/session/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; import "temporal/api/update/v1/message.proto"; import "temporal/api/workflow/v1/message.proto"; @@ -465,6 +466,9 @@ message ActivityTaskScheduledEventAttributes { // Priority metadata. If this message is not present, or any fields are not // present, they inherit the values from the workflow. temporal.api.common.v1.Priority priority = 14; + // Preserves the scheduling command's session routing options so activity state + // can be reconstructed from history. + temporal.api.session.v1.ActivitySessionOptions session_options = 15; } message ActivityTaskStartedEventAttributes { diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto new file mode 100644 index 000000000..4a7cdb2e5 --- /dev/null +++ b/temporal/api/session/v1/message.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package temporal.api.session.v1; + +option go_package = "go.temporal.io/api/session/v1;session"; +option java_package = "io.temporal.api.session.v1"; +option java_multiple_files = true; +option java_outer_classname = "MessageProto"; +option ruby_package = "Temporalio::Api::Session::V1"; +option csharp_namespace = "Temporalio.Api.Session.V1"; + +// EXPERIMENTAL. Subject to redesign or removal. +// Configures a worker's polling for sessions that keep workflow and activity +// tasks on a stable worker destination. Activities opt into session routing +// through ActivitySessionOptions on their scheduling commands. +message WorkerSessionOptions { + oneof isolation { + SingleSessionOptions single_session = 1; + } +} + +// EXPERIMENTAL. Subject to redesign or removal. +// Dedicates a sticky destination to the first workflow matched to it. +// Workflow sticky polls may be forwarded to the normal queue until the first +// workflow task is dispatched. The server persists that workflow ID and does +// not forward subsequent polls, including after workflow completion. +// Activity sticky polls are never forwarded to the normal queue. +message SingleSessionOptions { + // Stable sticky task queue name, shared by workflow and activity polls. + // Reuse this value across worker restarts within the same session, but not + // across concurrently running workers. This is distinct from worker identity. + // The SDK must also set the polled sticky task queue's name to this value. + string stable_identity = 1; +} + +message ActivitySessionOptions { + oneof session { + // Execute this activity as part of its workflow's session. + // Currently routes to the workflow's sticky task queue when true. + bool use_workflow_session = 1; + + // later session_id, etc + } +} diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 2ad815a5e..e570a9466 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -38,6 +38,7 @@ import "temporal/api/replication/v1/message.proto"; import "temporal/api/rules/v1/message.proto"; import "temporal/api/sdk/v1/worker_config.proto"; import "temporal/api/schedule/v1/message.proto"; +import "temporal/api/session/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; import "temporal/api/update/v1/message.proto"; import "temporal/api/version/v1/message.proto"; @@ -323,6 +324,9 @@ message PollWorkflowTaskQueueRequest { // Removed in 1.55.0; was temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat reserved 7; reserved "worker_heartbeat"; + + // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. + temporal.api.session.v1.WorkerSessionOptions session_options = 11; } message PollWorkflowTaskQueueResponse { @@ -553,6 +557,9 @@ message PollActivityTaskQueueRequest { // Removed in 1.55.0; was temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat reserved 7; reserved "worker_heartbeat"; + + // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. + temporal.api.session.v1.WorkerSessionOptions session_options = 11; } message PollActivityTaskQueueResponse {