Skip to main content

WorkerClient

Trait WorkerClient 

Source
pub trait WorkerClient: Sync + Send {
Show 25 methods // Required methods fn poll_workflow_task<'life0, 'async_trait>( &'life0 self, poll_options: PollOptions, wf_options: PollWorkflowOptions, ) -> Pin<Box<dyn Future<Output = Result<PollWorkflowTaskQueueResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn poll_activity_task<'life0, 'async_trait>( &'life0 self, poll_options: PollOptions, act_options: PollActivityOptions, ) -> Pin<Box<dyn Future<Output = Result<PollActivityTaskQueueResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn poll_nexus_task<'life0, 'async_trait>( &'life0 self, poll_options: PollOptions, send_heartbeat: bool, ) -> Pin<Box<dyn Future<Output = Result<PollNexusTaskQueueResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn complete_workflow_task<'life0, 'async_trait>( &'life0 self, request: WorkflowTaskCompletion, ) -> Pin<Box<dyn Future<Output = Result<RespondWorkflowTaskCompletedResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn complete_activity_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, result: Option<Payloads>, ) -> Pin<Box<dyn Future<Output = Result<RespondActivityTaskCompletedResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn complete_nexus_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, response: Response, ) -> Pin<Box<dyn Future<Output = Result<RespondNexusTaskCompletedResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn record_activity_heartbeat<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, details: Option<Payloads>, ) -> Pin<Box<dyn Future<Output = Result<RecordActivityTaskHeartbeatResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn cancel_activity_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, details: Option<Payloads>, ) -> Pin<Box<dyn Future<Output = Result<RespondActivityTaskCanceledResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn fail_activity_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, failure: Option<Failure>, ) -> Pin<Box<dyn Future<Output = Result<RespondActivityTaskFailedResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn fail_workflow_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, cause: WorkflowTaskFailedCause, failure: Option<Failure>, ) -> Pin<Box<dyn Future<Output = Result<RespondWorkflowTaskFailedResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn fail_nexus_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, error: NexusTaskFailure, ) -> Pin<Box<dyn Future<Output = Result<RespondNexusTaskFailedResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_workflow_execution_history<'life0, 'async_trait>( &'life0 self, workflow_id: String, run_id: Option<String>, page_token: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<GetWorkflowExecutionHistoryResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn respond_legacy_query<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, query_result: LegacyQueryResult, ) -> Pin<Box<dyn Future<Output = Result<RespondQueryTaskCompletedResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn describe_namespace<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<DescribeNamespaceResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn shutdown_worker<'life0, 'async_trait>( &'life0 self, sticky_task_queue: String, task_queue: String, task_queue_types: Vec<TaskQueueType>, final_heartbeat: Option<WorkerHeartbeat>, ) -> Pin<Box<dyn Future<Output = Result<ShutdownWorkerResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn record_worker_heartbeat<'life0, 'async_trait>( &'life0 self, namespace: String, worker_heartbeat: Vec<WorkerHeartbeat>, ) -> Pin<Box<dyn Future<Output = Result<RecordWorkerHeartbeatResponse, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn replace_connection(&self, new_client: Connection); fn capabilities(&self) -> Option<Capabilities>; fn workers(&self) -> Arc<ClientWorkerSet> ; fn is_mock(&self) -> bool; fn sdk_name_and_version(&self) -> (String, String); fn identity(&self) -> String; fn worker_grouping_key(&self) -> Uuid; fn worker_instance_key(&self) -> Uuid; fn set_heartbeat_client_fields(&self, heartbeat: &mut WorkerHeartbeat);
}
Expand description

This trait contains everything workers need to interact with Temporal, and hence provides a minimal mocking surface.

Required Methods§

Source

fn poll_workflow_task<'life0, 'async_trait>( &'life0 self, poll_options: PollOptions, wf_options: PollWorkflowOptions, ) -> Pin<Box<dyn Future<Output = Result<PollWorkflowTaskQueueResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Poll workflow tasks

Source

fn poll_activity_task<'life0, 'async_trait>( &'life0 self, poll_options: PollOptions, act_options: PollActivityOptions, ) -> Pin<Box<dyn Future<Output = Result<PollActivityTaskQueueResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Poll activity tasks

Source

fn poll_nexus_task<'life0, 'async_trait>( &'life0 self, poll_options: PollOptions, send_heartbeat: bool, ) -> Pin<Box<dyn Future<Output = Result<PollNexusTaskQueueResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Poll Nexus tasks

Source

fn complete_workflow_task<'life0, 'async_trait>( &'life0 self, request: WorkflowTaskCompletion, ) -> Pin<Box<dyn Future<Output = Result<RespondWorkflowTaskCompletedResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Complete a workflow task

Source

fn complete_activity_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, result: Option<Payloads>, ) -> Pin<Box<dyn Future<Output = Result<RespondActivityTaskCompletedResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Complete an activity task

Source

fn complete_nexus_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, response: Response, ) -> Pin<Box<dyn Future<Output = Result<RespondNexusTaskCompletedResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Complete a Nexus task

Source

fn record_activity_heartbeat<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, details: Option<Payloads>, ) -> Pin<Box<dyn Future<Output = Result<RecordActivityTaskHeartbeatResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Record an activity heartbeat

Source

fn cancel_activity_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, details: Option<Payloads>, ) -> Pin<Box<dyn Future<Output = Result<RespondActivityTaskCanceledResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Cancel an activity task

Source

fn fail_activity_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, failure: Option<Failure>, ) -> Pin<Box<dyn Future<Output = Result<RespondActivityTaskFailedResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fail an activity task

Source

fn fail_workflow_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, cause: WorkflowTaskFailedCause, failure: Option<Failure>, ) -> Pin<Box<dyn Future<Output = Result<RespondWorkflowTaskFailedResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fail a workflow task

Source

fn fail_nexus_task<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, error: NexusTaskFailure, ) -> Pin<Box<dyn Future<Output = Result<RespondNexusTaskFailedResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fail a Nexus task

Source

fn get_workflow_execution_history<'life0, 'async_trait>( &'life0 self, workflow_id: String, run_id: Option<String>, page_token: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<GetWorkflowExecutionHistoryResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the workflow execution history

Source

fn respond_legacy_query<'life0, 'async_trait>( &'life0 self, task_token: TaskToken, query_result: LegacyQueryResult, ) -> Pin<Box<dyn Future<Output = Result<RespondQueryTaskCompletedResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Respond to a legacy query

Source

fn describe_namespace<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<DescribeNamespaceResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Describe the namespace

Source

fn shutdown_worker<'life0, 'async_trait>( &'life0 self, sticky_task_queue: String, task_queue: String, task_queue_types: Vec<TaskQueueType>, final_heartbeat: Option<WorkerHeartbeat>, ) -> Pin<Box<dyn Future<Output = Result<ShutdownWorkerResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Shutdown the worker

Source

fn record_worker_heartbeat<'life0, 'async_trait>( &'life0 self, namespace: String, worker_heartbeat: Vec<WorkerHeartbeat>, ) -> Pin<Box<dyn Future<Output = Result<RecordWorkerHeartbeatResponse, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Record a worker heartbeat

Source

fn replace_connection(&self, new_client: Connection)

Replace the underlying connection

Source

fn capabilities(&self) -> Option<Capabilities>

Return server capabilities

Source

fn workers(&self) -> Arc<ClientWorkerSet>

Return workers using this client

Source

fn is_mock(&self) -> bool

Indicates if this is a mock client

Source

fn sdk_name_and_version(&self) -> (String, String)

Return name and version of the SDK

Source

fn identity(&self) -> String

Get worker identity

Source

fn worker_grouping_key(&self) -> Uuid

Get worker grouping key

Source

fn worker_instance_key(&self) -> Uuid

Get worker instance key (unique per worker instance)

Source

fn set_heartbeat_client_fields(&self, heartbeat: &mut WorkerHeartbeat)

Sets the client-reliant fields for WorkerHeartbeat. This also updates client-level tracking of heartbeat fields, like last heartbeat timestamp.

Implementors§