Trait apalis::prelude::WorkerFactory

source ·
pub trait WorkerFactory<J, S> {
    type Source;
    type Service;

    // Required method
    fn build(self, service: S) -> Worker<Ready<Self::Service, Self::Source>>;
}
Expand description

Helper trait for building new Workers from WorkerBuilder

Required Associated Types§

source

type Source

The request source for the worker

source

type Service

The service that the worker will run jobs against

Required Methods§

source

fn build(self, service: S) -> Worker<Ready<Self::Service, Self::Source>>

Builds a WorkerFactory using a tower service that can be used to generate a new Worker using the build method

§Arguments
  • service - A tower service
§Examples

Implementors§

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>,

§

type Source = P

§

type Service = <M as Layer<<<P as Backend<Request<Req>>>::Layer as Layer<S>>::Service>>::Service