pub struct Worker { /* private fields */ }Expand description
Runs the commands of its aggregates: the kernel sends each command with the aggregate’s
events, the worker decides and sends the new events back, signed. Cloning gives another
handle to the same worker. Made with crate::Kernable::worker; the configuring methods
return it, so they chain.
run().await processes commands until stop(). To do something once it is connected,
spawn it and wait: let worker = kernable.worker(&cart_aggregate); tokio::spawn({ let worker = worker.clone(); async move { worker.run().await } }); worker.ready().await;.
Implementations§
Source§impl Worker
impl Worker
Sourcepub fn aggregate<S: State>(&self, aggregate: &Aggregate<S>) -> Worker
pub fn aggregate<S: State>(&self, aggregate: &Aggregate<S>) -> Worker
Runs the commands of aggregate, too.
Sourcepub fn concurrency(&self, commands: u32) -> Worker
pub fn concurrency(&self, commands: u32) -> Worker
Commands executed in parallel (default 16).
Sourcepub fn reconnect(&self, delay: Duration) -> Worker
pub fn reconnect(&self, delay: Duration) -> Worker
Delay before reconnecting after the session ends (default 1 s); twice as long after each further failed attempt, at most 30 s.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Worker
impl !UnwindSafe for Worker
impl Forget for Worker
impl Freeze for Worker
impl Move for Worker
impl Send for Worker
impl Sync for Worker
impl Unpin for Worker
impl UnsafeUnpin for Workerwhere
*const ArcInner<WorkerInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<WorkerInner>>: UnsafeUnpin,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request