ruststream-lapin connects a RustStream service to RabbitMQ over
lapin, the AMQP 0.9.1 client. Handlers, routing, codecs and
middleware come from the framework; this crate is the transport.
Features
- Native settlement:
ackisbasic.ack, a retry isbasic.rejectwith requeue, and a drop goes to the queue's dead-letter exchange. - A descriptor per queue type:
RabbitQueuefor classic queues,RabbitQuorumQueuefor quorum queues, with bindings, prefetch and dead-letter settings. - Your topology: nothing is created on the broker unless the service opts in with
declare_topology(true). - Durable delayed retry through a TTL waiting queue or the delayed-message-exchange plugin, and a retry cap a quorum queue enforces itself.
- Three publishers: fire-and-forget, publisher confirms with client-side transactions, and AMQP channel transactions. Priority, TTL and persistence are typed per-message settings.
- Request/reply over direct reply-to.
- AsyncAPI with the specification's
amqpbindings, behind theasyncapifeature. - Tests without a server: the service's own app runs with
LapinBrokerin process.
Install
[]
= { = "0.7", = ["macros", "json", "asyncapi", "logging"] }
= "0.7"
= { = "1", = ["derive"] }
[]
= { = "0.7", = ["testing"] }
Optional features: asyncapi, TLS (tls-rustls, tls-rustls-ring, tls-native-tls), and the
broker plugins plugin-consistent-hash and plugin-dme.
Write a service
use *;
use ;
async
#[ruststream::app] generates main, so the binary understands run and asyncapi gen.
Scaffold a fresh project from a template, a work queue or a topic exchange:
Test it
TestApp runs the service's own app with LapinBroker in process, with no server.
use TestApp;
let tb = start.await?;
tb.
.message
.to
.publish
.await?;
tb.
.subscriber
.assert_called_once
.settled;
tb.
.
.assert_called_once
.with;
TestApp::start_live(app()) runs the same test against a running RabbitMQ.
Documentation
- Getting started - installation, the transport model and the service scaffolds.
- Guides - building a RabbitMQ service with the crate.
- Components - one page per part of the crate.
- Architecture - how the crate sits between
lapinand the runtime. - Benchmarks - what the crate costs over the raw client.
- API reference - every item on docs.rs; the crate overview maps each topic to its page.
- The framework: https://powersemmi.github.io/ruststream/latest/
Minimum supported Rust version
The MSRV is 1.95, edition 2024.
Contributing
See CONTRIBUTING.md.
License
Licensed under the Apache-2.0 license.