Trait apalis::prelude::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

Implementations on Foreign Types§

source§

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

§

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

§

type Layer = ServiceBuilder<Identity>

source§

fn common_layer( &self, _worker: WorkerId ) -> <Pin<Box<dyn Stream<Item = Result<Option<Request<T>>, Error>> + Send>> as Backend<Request<T>>>::Layer

source§

fn poll( self, _worker: WorkerId ) -> Poller<<Pin<Box<dyn Stream<Item = Result<Option<Request<T>>, Error>> + Send>> as Backend<Request<T>>>::Stream>

Implementors§

source§

impl<T> Backend<Request<T>> for MysqlStorage<T>
where T: Job + Serialize + DeserializeOwned + Sync + Send + Unpin + 'static,

source§

impl<T> Backend<Request<T>> for PostgresStorage<T>
where T: Job + Serialize + DeserializeOwned + Sync + Send + Unpin + 'static,

source§

impl<T> Backend<Request<T>> for RedisStorage<T>
where T: Job + Serialize + DeserializeOwned + Sync + Send + Unpin + 'static,

source§

impl<T> Backend<Request<T>> for SqliteStorage<T>
where T: Job + Serialize + DeserializeOwned + Sync + Send + Unpin + 'static,

source§

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