pub struct KojinBuilder<B: Broker> { /* private fields */ }Expand description
Builder for configuring and running a Kojin worker.
Implementations§
Source§impl<B: Broker> KojinBuilder<B>
impl<B: Broker> KojinBuilder<B>
Sourcepub fn register_task<T: Task>(self) -> Self
pub fn register_task<T: Task>(self) -> Self
Register a task type.
Sourcepub fn data<T: Send + Sync + 'static>(self, value: T) -> Self
pub fn data<T: Send + Sync + 'static>(self, value: T) -> Self
Add shared data accessible via ctx.data::<T>().
Sourcepub fn middleware(self, mw: impl Middleware) -> Self
pub fn middleware(self, mw: impl Middleware) -> Self
Add a middleware.
Sourcepub fn concurrency(self, n: usize) -> Self
pub fn concurrency(self, n: usize) -> Self
Set concurrency (max parallel tasks).
Sourcepub fn shutdown_timeout(self, timeout: Duration) -> Self
pub fn shutdown_timeout(self, timeout: Duration) -> Self
Set shutdown timeout.
Sourcepub fn result_backend(self, rb: impl ResultBackend) -> Self
pub fn result_backend(self, rb: impl ResultBackend) -> Self
Set the result backend for storing task results and workflow coordination.
A result backend is required for workflows (chain!, group!, chord)
and for retrieving task return values. If you only need fire-and-forget
execution, this can be omitted.
Set a shared result backend (already wrapped in Arc).
Use this when the same backend must be shared between
Canvas::apply() and the worker.
Auto Trait Implementations§
impl<B> Freeze for KojinBuilder<B>where
B: Freeze,
impl<B> !RefUnwindSafe for KojinBuilder<B>
impl<B> Send for KojinBuilder<B>
impl<B> Sync for KojinBuilder<B>
impl<B> Unpin for KojinBuilder<B>where
B: Unpin,
impl<B> UnsafeUnpin for KojinBuilder<B>where
B: UnsafeUnpin,
impl<B> !UnwindSafe for KojinBuilder<B>
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more