pub trait MessageQueue: Send + Sync {
// Required methods
fn publish(
&self,
topic: &str,
message: &Value,
) -> Result<String, QueueError>;
fn consume(
&self,
topic: &str,
count: usize,
block_ms: usize,
) -> Result<Vec<(String, Value)>, QueueError>;
fn ack(&self, topic: &str, message_id: &str) -> Result<(), QueueError>;
fn extend_visibility(
&self,
topic: &str,
message_id: &str,
seconds: u64,
) -> Result<(), QueueError>;
}Expand description
Caravan-owned seam for at-least-once message queues. Decorated with
#[wagon] so callers dispatch via client::<dyn MessageQueue>().
The topic: parameter is a portability device: Redis Streams +
RabbitMQ use it as a queue/stream name; SQS ignores it (each SQS
queue URL is its own substrate).
Required Methods§
fn publish(&self, topic: &str, message: &Value) -> Result<String, QueueError>
fn consume( &self, topic: &str, count: usize, block_ms: usize, ) -> Result<Vec<(String, Value)>, QueueError>
fn ack(&self, topic: &str, message_id: &str) -> Result<(), QueueError>
fn extend_visibility( &self, topic: &str, message_id: &str, seconds: u64, ) -> Result<(), QueueError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".