pub struct WorkerContext { /* private fields */ }Implementations§
Source§impl WorkerContext
impl WorkerContext
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a worker context backed by an embedded, lazily-created
ConversationSupervisor per dispatch channel.
Note: the embedded supervisor runs on a single-thread beamr scheduler, so all worker link monitors for a channel share one scheduler thread. This is appropriate for the single-process embedded case; deployments that register very large worker pools should front them with an externally-constructed, multi-threaded supervisor rather than relying on this default.
Sourcepub fn register_worker(
&self,
namespace: &str,
task_queue: &str,
capacity: WorkerCapacity,
) -> Result<WorkerRegistration, AionSurfaceError>
pub fn register_worker( &self, namespace: &str, task_queue: &str, capacity: WorkerCapacity, ) -> Result<WorkerRegistration, AionSurfaceError>
§Errors
Returns when channel resolution, channel creation, or subscription opening fails.
Sourcepub fn register_worker_with_participant(
&self,
namespace: &str,
task_queue: &str,
worker_id: impl Into<String>,
participant: ParticipantPid,
capacity: WorkerCapacity,
) -> Result<WorkerRegistration, AionSurfaceError>
pub fn register_worker_with_participant( &self, namespace: &str, task_queue: &str, worker_id: impl Into<String>, participant: ParticipantPid, capacity: WorkerCapacity, ) -> Result<WorkerRegistration, AionSurfaceError>
§Errors
Returns when the dispatch channel cannot be resolved or subscribed.
Sourcepub fn workers_for_channel(
&self,
channel_name: &ChannelName,
request: &ActivityRequest,
) -> Result<Vec<DispatchWorker>, AionSurfaceError>
pub fn workers_for_channel( &self, channel_name: &ChannelName, request: &ActivityRequest, ) -> Result<Vec<DispatchWorker>, AionSurfaceError>
§Errors
Returns when the worker pool cannot be read.
Trait Implementations§
Source§impl Clone for WorkerContext
impl Clone for WorkerContext
Source§fn clone(&self) -> WorkerContext
fn clone(&self) -> WorkerContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkerContext
impl Debug for WorkerContext
Source§impl Default for WorkerContext
impl Default for WorkerContext
Source§impl DispatchWorkerPool for WorkerContext
impl DispatchWorkerPool for WorkerContext
Source§fn workers_for(
&self,
channel_name: &ChannelName,
request: &ActivityRequest,
) -> Result<Vec<DispatchWorker>, AionSurfaceError>
fn workers_for( &self, channel_name: &ChannelName, request: &ActivityRequest, ) -> Result<Vec<DispatchWorker>, AionSurfaceError>
Returns workers currently subscribed to the dispatch channel. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for WorkerContext
impl !UnwindSafe for WorkerContext
impl Freeze for WorkerContext
impl Send for WorkerContext
impl Sync for WorkerContext
impl Unpin for WorkerContext
impl UnsafeUnpin for WorkerContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more