Expand description
RabbitMQ / AMQP 0.9.1 broker for the
RustStream messaging framework, backed by
lapin.
§Transport model
A subscription consumes one queue; RabbitQueue describes the queue and its bindings, and
the bare-string #[subscriber("orders")] form consumes the queue named orders. On the
publish side OutgoingMessage::name is the routing key, sent
to the publisher’s exchange (the default exchange unless configured, where the routing key
addresses the queue with that name).
Settlement uses the protocol natively, with no republish tricks:
- ack sends
basic.ack - retry (
nack(true)) sendsbasic.nackwith requeue - drop (
nack(false)) sendsbasic.rejectwithout requeue, dead-lettering when the queue has a dead-letter exchange
§The lifecycle ladder
LapinBroker::new is synchronous and I/O-free, so a service composes with the synchronous
#[ruststream::app] builder. The network work happens in the consuming Broker::connect,
called once by the runtime at startup, which yields ConnectedLapinBroker: subscriptions,
publishers, and requesters exist only from there, and ConnectedBroker::shutdown consumes it
again into ClosedLapinBroker. Publishers are declared as policies (LapinPublish,
ConfirmsPublish, ServerTxPublish, LapinRequest) that hold no connection and pair
into their live form against the connected broker.
§Topology
Descriptors describe the EXPECTED topology; nothing is created on the broker by default,
because managing infrastructure is the user’s job. Declaration is a per-broker opt-in:
LapinBroker::declare_topology.
Modules§
- context
- Per-delivery context fields exposed to handlers.
- testing
- In-process test broker, behind the
testingfeature.
Structs§
- Closed
Lapin Broker - The terminal witness returned by shutting down a
ConnectedLapinBroker. - Confirms
Publish - The confirm-transactional publish policy: same options as
LapinPublish, pairing intoConfirmsPublisher. - Confirms
Publisher - The live publisher that awaits broker confirms for every message.
- Confirms
Transaction - An owned confirm-transaction, opened by
transactionon aConfirmsPublisher. - Connected
Lapin Broker - The typed witness that
Broker::connectsucceeded: holds the live connection. - Direct
Reply To - Redirects each reply of a
#[subscriber(.., publish(..))]handler to the requester’s private reply-to address, echoing its correlation id. - Field
Table - A Map<String, AMQPValue>
- Lapin
Broker - A
RabbitMQbroker backed bylapin: configuration captured, no I/O performed yet. - Lapin
Message - One AMQP delivery, settled with the protocol’s native acknowledgement frames.
- Lapin
Publish - The fire-and-forget publish policy: pure declaration, constructible anywhere.
- Lapin
Publisher - The live fire-and-forget publisher, on the connection’s shared publish channel. Cheap to clone.
- Lapin
Request - The request/reply policy: pure declaration, constructible anywhere, pairing into
LapinRequester. - Lapin
Requester - The live request/reply client over
RabbitMQdirect reply-to. - Lapin
Subscriber - A consumer on one queue, yielding
LapinMessagedeliveries. - Rabbit
Exchange - Describes the exchange side of a
RabbitQueuebinding. - Rabbit
Queue - Describes one queue subscription: the queue, its expected settings, and its bindings.
- Server
TxPublish - The server-transactional publish policy: same options as
LapinPublish, pairing intoServerTxPublisher. - Server
TxPublisher - The live publisher backed by AMQP server transactions (
tx.select/tx.commit/tx.rollback).
Enums§
- AMQP
Value - Enumeration referencing the possible AMQP values depending on the types
- Amqp
Error - Errors returned by
LapinBrokerand the types it hands out. - Delay
- How a subscription handles
retry_after/nack_afterdelays. - Queue
Type - The queue implementation selected at declaration time.
Constants§
- PARTITION_
KEY_ HEADER - Header carrying a message’s partition key, read by
Partitionedfor keyed worker lanes.
Traits§
- Lapin
Publish Policy - A publish policy that pairs with a connected
RabbitMQbroker without opening a channel.