Struct apalis::prelude::WorkerBuilder
source · pub struct WorkerBuilder<Req, Source, Middleware, Serv> { /* private fields */ }
Expand description
Allows building a Worker
.
Usually the output is Worker<Ready>
Implementations§
source§impl<Serv> WorkerBuilder<(), (), Identity, Serv>
impl<Serv> WorkerBuilder<(), (), Identity, Serv>
sourcepub fn new<T>(name: T) -> WorkerBuilder<(), (), Identity, Serv>
pub fn new<T>(name: T) -> WorkerBuilder<(), (), Identity, Serv>
Build a new WorkerBuilder
instance with a name for the worker to build
source§impl<J, S, M, Serv> WorkerBuilder<J, S, M, Serv>
impl<J, S, M, Serv> WorkerBuilder<J, S, M, Serv>
sourcepub fn stream<NS, NJ>(self, stream: NS) -> WorkerBuilder<NJ, NS, M, Serv>
pub fn stream<NS, NJ>(self, stream: NS) -> WorkerBuilder<NJ, NS, M, Serv>
Consume a stream directly
sourcepub fn with_storage<NS, NJ>(self, storage: NS) -> WorkerBuilder<NJ, NS, M, Serv>where
NS: Storage<Job = NJ>,
pub fn with_storage<NS, NJ>(self, storage: NS) -> WorkerBuilder<NJ, NS, M, Serv>where
NS: Storage<Job = NJ>,
Set the source to a Storage
sourcepub fn with_mq<NS, NJ>(
self,
message_queue: NS
) -> WorkerBuilder<NJ, NS, M, Serv>where
NS: MessageQueue<NJ>,
pub fn with_mq<NS, NJ>(
self,
message_queue: NS
) -> WorkerBuilder<NJ, NS, M, Serv>where
NS: MessageQueue<NJ>,
Set the source to a MessageQueue
source§impl<Request, Stream, M, Serv> WorkerBuilder<Request, Stream, M, Serv>
impl<Request, Stream, M, Serv> WorkerBuilder<Request, Stream, M, Serv>
sourcepub fn chain<NewLayer>(
self,
f: impl Fn(ServiceBuilder<M>) -> ServiceBuilder<NewLayer>
) -> WorkerBuilder<Request, Stream, NewLayer, Serv>
pub fn chain<NewLayer>( self, f: impl Fn(ServiceBuilder<M>) -> ServiceBuilder<NewLayer> ) -> WorkerBuilder<Request, Stream, NewLayer, Serv>
Allows of decorating the service that consumes jobs.
Allows adding multiple tower
middleware
Trait Implementations§
source§impl<Req, Source, Middleware, Serv> Debug for WorkerBuilder<Req, Source, Middleware, Serv>
impl<Req, Source, Middleware, Serv> Debug for WorkerBuilder<Req, Source, Middleware, Serv>
source§impl<Req, P, M, S> WorkerFactory<Req, S> for WorkerBuilder<Req, P, M, S>where
Req: Send + 'static + Sync,
P: Backend<Request<Req>> + 'static,
M: 'static + Layer<<<P as Backend<Request<Req>>>::Layer as Layer<S>>::Service>,
S: Service<Request<Req>> + Send + 'static + Clone + Sync,
<S as Service<Request<Req>>>::Future: Send,
<S as Service<Request<Req>>>::Response: 'static,
<P as Backend<Request<Req>>>::Layer: Layer<S>,
impl<Req, P, M, S> WorkerFactory<Req, S> for WorkerBuilder<Req, P, M, S>where
Req: Send + 'static + Sync,
P: Backend<Request<Req>> + 'static,
M: 'static + Layer<<<P as Backend<Request<Req>>>::Layer as Layer<S>>::Service>,
S: Service<Request<Req>> + Send + 'static + Clone + Sync,
<S as Service<Request<Req>>>::Future: Send,
<S as Service<Request<Req>>>::Response: 'static,
<P as Backend<Request<Req>>>::Layer: Layer<S>,
source§fn build(
self,
service: S
) -> Worker<Ready<<WorkerBuilder<Req, P, M, S> as WorkerFactory<Req, S>>::Service, P>>
fn build( self, service: S ) -> Worker<Ready<<WorkerBuilder<Req, P, M, S> as WorkerFactory<Req, S>>::Service, P>>
Build a worker, given a tower service
Auto Trait Implementations§
impl<Req, Source, Middleware, Serv> Freeze for WorkerBuilder<Req, Source, Middleware, Serv>
impl<Req, Source, Middleware, Serv> RefUnwindSafe for WorkerBuilder<Req, Source, Middleware, Serv>
impl<Req, Source, Middleware, Serv> Send for WorkerBuilder<Req, Source, Middleware, Serv>
impl<Req, Source, Middleware, Serv> Sync for WorkerBuilder<Req, Source, Middleware, Serv>
impl<Req, Source, Middleware, Serv> Unpin for WorkerBuilder<Req, Source, Middleware, Serv>
impl<Req, Source, Middleware, Serv> UnwindSafe for WorkerBuilder<Req, Source, Middleware, Serv>
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 moresource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
source§impl<J, W, F, K> WorkerFactoryFn<J, F, K> for Wwhere
W: WorkerFactory<J, ServiceFn<F, K>>,
impl<J, W, F, K> WorkerFactoryFn<J, F, K> for Wwhere
W: WorkerFactory<J, ServiceFn<F, K>>,
§type Service = <W as WorkerFactory<J, ServiceFn<F, K>>>::Service
type Service = <W as WorkerFactory<J, ServiceFn<F, K>>>::Service
The service that the worker will run jobs against
source§fn build_fn(
self,
f: F
) -> Worker<Ready<<W as WorkerFactoryFn<J, F, K>>::Service, <W as WorkerFactoryFn<J, F, K>>::Source>>
fn build_fn( self, f: F ) -> Worker<Ready<<W as WorkerFactoryFn<J, F, K>>::Service, <W as WorkerFactoryFn<J, F, K>>::Source>>
Builds a
WorkerFactoryFn
using ServiceFn
that can be used to generate new Worker
using the build_fn
method Read more