Skip to main content

QueueWorker

Trait QueueWorker 

Source
pub trait QueueWorker {
    type Message;

    // Required methods
    fn receive_task(
        &self,
    ) -> impl Future<Output = Result<Option<WrappedTask<Self::Message>>>>;
    fn send_response(
        &self,
        message: Self::Message,
        response: Response,
    ) -> impl Future<Output = Result<()>>;
}
Expand description

Receives queued tasks and routes their responses back to producers.

Returned futures do not carry a Send guarantee; this trait is not dyn-compatible.

Required Associated Types§

Source

type Message

Backend-specific reply metadata attached to each received task.

Required Methods§

Source

fn receive_task( &self, ) -> impl Future<Output = Result<Option<WrappedTask<Self::Message>>>>

Receives a task, or None when none is available or the stream ends.

NATS and std memory wait for work; no_std memory polls once.

Source

fn send_response( &self, message: Self::Message, response: Response, ) -> impl Future<Output = Result<()>>

Sends a response using the metadata from the corresponding task.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§