Expand description
RabbitMQ messaging over lapin: durable queues with optional retry and dead-letter queues.
QueueConsumer receives JSON-encoded messages of type T, while
MessageProducer publishes them. PublishOptions controls durability,
prefetch, retry, and dead-letter behavior.
Queue names: the main queue is <name>, the retry queue is <name>.retry
(dead-letters back after the TTL), and the dead-letter queue is
<name>.dlq. Failed messages go to the retry queue while the retry count
is below max_retries, then to the dead-letter queue when enabled.
Use this module when work should be processed asynchronously by another task.
ⓘ
let producer = MessageProducer::new("amqp://guest:guest@localhost:5672").await?;
producer.publish("jobs", &serde_json::json!({"id": 1})).await?;
let consumer = QueueConsumer::<serde_json::Value>::connect(
"amqp://guest:guest@localhost:5672",
"jobs",
PublishOptions::default(),
)
.await?;
consumer.declare().await?;Structs§
- Message
Producer - Publishes JSON-encoded messages to a broker over one lapin channel.
- Publish
Options - Options controlling queue declaration and failure handling.
- Queue
Consumer - Lapin-backed consumer for JSON messages of type
T.