Skip to main content

ClientWorker

Trait ClientWorker 

Source
pub trait ClientWorker: Send + Sync {
    // Required methods
    fn namespace(&self) -> &str;
    fn task_queue(&self) -> &str;
    fn try_reserve_wft_slot(&self) -> Option<Box<dyn Slot + Send>>;
    fn deployment_options(&self) -> Option<WorkerDeploymentOptions>;
    fn worker_instance_key(&self) -> Uuid;
    fn heartbeat_enabled(&self) -> bool;
    fn heartbeat_callback(&self) -> Option<HeartbeatCallback>;
    fn new_shared_namespace_worker(
        &self,
    ) -> Result<Box<dyn SharedNamespaceWorkerTrait + Send + Sync>, Error>;
    fn worker_task_types(&self) -> WorkerTaskTypes;
}
Expand description

Represents a complete worker that can handle both slot management and worker heartbeat functionality.

Required Methods§

Source

fn namespace(&self) -> &str

The namespace this worker operates in

Source

fn task_queue(&self) -> &str

The task queue this worker listens to

Source

fn try_reserve_wft_slot(&self) -> Option<Box<dyn Slot + Send>>

Try to reserve a slot for workflow task processing.

This method should return Some(slot) if a workflow task slot is available, or None if all slots are currently in use. The returned slot will be used to process exactly one workflow task.

Source

fn deployment_options(&self) -> Option<WorkerDeploymentOptions>

Get the worker deployment options for this worker, if using deployment-based versioning.

Source

fn worker_instance_key(&self) -> Uuid

Unique identifier for this worker instance. This must be stable across the worker’s lifetime and unique per instance.

Source

fn heartbeat_enabled(&self) -> bool

Indicates if worker heartbeating is enabled for this client worker.

Source

fn heartbeat_callback(&self) -> Option<HeartbeatCallback>

Returns the heartbeat callback that can be used to get WorkerHeartbeat data.

Source

fn new_shared_namespace_worker( &self, ) -> Result<Box<dyn SharedNamespaceWorkerTrait + Send + Sync>, Error>

Creates a new worker that implements the SharedNamespaceWorkerTrait

Source

fn worker_task_types(&self) -> WorkerTaskTypes

Returns the task types this worker can handle

Implementors§