pub struct Worker { /* private fields */ }Implementations§
Source§impl Worker
impl Worker
pub fn new(client: Client, task_queue: impl Into<String>) -> Self
pub fn worker_id(self, worker_id: impl Into<String>) -> Self
pub fn poll_timeout(self, timeout: Duration) -> Self
pub fn heartbeat_interval(self, interval: Duration) -> Self
pub fn on_worker_heartbeat<F>(self, observer: F) -> Self
pub fn max_concurrent_workflow_tasks(self, count: usize) -> Self
pub fn max_concurrent_activity_tasks(self, count: usize) -> Self
pub fn register_workflow<F, Fut>( &mut self, workflow_type: impl Into<String>, handler: F, )
Sourcepub fn register_replayed_workflow<S, Factory, F, Fut>(
&mut self,
workflow_type: impl Into<String>,
state_factory: Factory,
handler: F,
)
pub fn register_replayed_workflow<S, Factory, F, Fut>( &mut self, workflow_type: impl Into<String>, state_factory: Factory, handler: F, )
Register a workflow whose typed instance state can be reconstructed for queries.
state_factory creates a fresh instance for every normal workflow task and
query replay. The workflow handler is the single source of truth for state
transitions: it updates WorkflowInstance after activities and signals
resolve. Query replay runs this same handler over committed history and
discards any commands it would emit.
pub fn register_activity<F, Fut>( &mut self, activity_type: impl Into<String>, handler: F, )
Sourcepub fn register_query<F, Fut>(
&mut self,
workflow_type: impl Into<String>,
query_name: impl Into<String>,
handler: F,
)
pub fn register_query<F, Fut>( &mut self, workflow_type: impl Into<String>, query_name: impl Into<String>, handler: F, )
Register a named, read-only query handler for a workflow type.
The workflow type must also be registered with Worker::register_workflow
before the worker runs. The handler receives only an immutable committed
state snapshot and normalized query arguments.
Sourcepub fn register_replayed_query<S, F, Fut>(
&mut self,
workflow_type: impl Into<String>,
query_name: impl Into<String>,
handler: F,
)
pub fn register_replayed_query<S, F, Fut>( &mut self, workflow_type: impl Into<String>, query_name: impl Into<String>, handler: F, )
Register a named query against deterministically replayed instance state.
The workflow type must use Worker::register_replayed_workflow with the
same state type S. The handler receives an immutable, detached state
clone, so successful and failed queries cannot affect workflow execution
or the state reconstructed by a later query.