Trait apalis_core::Backend

source ·
pub trait Backend<Req> {
    type Stream: Stream<Item = Result<Option<Req>, Error>>;
    type Layer;

    // Required methods
    fn common_layer(&self, worker: WorkerId) -> Self::Layer;
    fn poll(self, worker: WorkerId) -> Poller<Self::Stream>;
}
Expand description

A backend represents a task source Both Storage and MessageQueue need to implement it for workers to be able to consume tasks

Required Associated Types§

source

type Stream: Stream<Item = Result<Option<Req>, Error>>

The stream to be produced by the backend

source

type Layer

Returns the final decoration of layers

Required Methods§

source

fn common_layer(&self, worker: WorkerId) -> Self::Layer

Allows the backend to decorate the service with Layer

source

fn poll(self, worker: WorkerId) -> Poller<Self::Stream>

Returns a poller that is ready for streaming

Implementors§

source§

impl<T> Backend<Request<T>> for RequestStream<Request<T>>

§

type Stream = Pin<Box<dyn Stream<Item = Result<Option<Request<T>>, Error>> + Send>>

§

type Layer = ServiceBuilder<Identity>

source§

impl<T: Send + 'static + Sync> Backend<Request<T>> for MemoryStorage<T>

§

type Stream = BackendStream<Pin<Box<dyn Stream<Item = Result<Option<Request<T>>, Error>> + Send>>>

§

type Layer = ServiceBuilder<Identity>