Skip to main content

Queue

Trait Queue 

Source
pub trait Queue:
    Clone
    + Send
    + Sync
    + 'static {
    // Required methods
    fn publish(&self, topic: &str, message: Message) -> QueueFuture<()>;
    fn receive(&self, topic: &str) -> QueueFuture<Option<Delivery>>;
    fn ack(&self, receipt: &str) -> QueueFuture<()>;
    fn nack(&self, receipt: &str, delay: Duration) -> QueueFuture<()>;
}
Expand description

Adapter surface implemented by NATS, RabbitMQ, Kafka, SQS, and test queues.

Required Methods§

Source

fn publish(&self, topic: &str, message: Message) -> QueueFuture<()>

Publishes one message to a topic.

Source

fn receive(&self, topic: &str) -> QueueFuture<Option<Delivery>>

Takes the next visible delivery from a topic, if any.

Source

fn ack(&self, receipt: &str) -> QueueFuture<()>

Settles a delivery so it is never redelivered.

Source

fn nack(&self, receipt: &str, delay: Duration) -> QueueFuture<()>

Returns a delivery to its topic, invisible until delay has elapsed.

The adapter raises the delivery’s attempt count. It does not cap the attempts: the ceiling and the dead-letter route belong to Worker.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§