Skip to main content

QueueProducer

Trait QueueProducer 

Source
pub trait QueueProducer {
    type Message;

    // Required methods
    fn send_task(
        &self,
        task: Task,
    ) -> impl Future<Output = Result<Self::Message>>;
    fn receive_response(
        &self,
        message: Self::Message,
    ) -> impl Future<Output = Result<Option<Response>>>;
}
Expand description

Submits tasks and retrieves their responses.

Waiting and cancellation semantics depend on the backend. Returned futures do not carry a Send guarantee; this trait is not dyn-compatible.

Required Associated Types§

Source

type Message

Backend-specific handle used to correlate a submitted task’s response.

Required Methods§

Source

fn send_task(&self, task: Task) -> impl Future<Output = Result<Self::Message>>

Submits a task and returns its response handle, not its execution result.

Source

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

Consumes a handle to retrieve a response.

None may mean no response is ready (no_std memory) or the response stream ended (NATS); consult the backend before treating it as terminal.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§