Skip to main content

Crate ruststream_lapin

Crate ruststream_lapin 

Source
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)) sends basic.nack with requeue
  • drop (nack(false)) sends basic.reject without 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 testing feature.

Structs§

ClosedLapinBroker
The terminal witness returned by shutting down a ConnectedLapinBroker.
ConfirmsPublish
The confirm-transactional publish policy: same options as LapinPublish, pairing into ConfirmsPublisher.
ConfirmsPublisher
The live publisher that awaits broker confirms for every message.
ConfirmsTransaction
An owned confirm-transaction, opened by transaction on a ConfirmsPublisher.
ConnectedLapinBroker
The typed witness that Broker::connect succeeded: holds the live connection.
DirectReplyTo
Redirects each reply of a #[subscriber(.., publish(..))] handler to the requester’s private reply-to address, echoing its correlation id.
FieldTable
A Map<String, AMQPValue>
LapinBroker
A RabbitMQ broker backed by lapin: configuration captured, no I/O performed yet.
LapinMessage
One AMQP delivery, settled with the protocol’s native acknowledgement frames.
LapinPublish
The fire-and-forget publish policy: pure declaration, constructible anywhere.
LapinPublisher
The live fire-and-forget publisher, on the connection’s shared publish channel. Cheap to clone.
LapinRequest
The request/reply policy: pure declaration, constructible anywhere, pairing into LapinRequester.
LapinRequester
The live request/reply client over RabbitMQ direct reply-to.
LapinSubscriber
A consumer on one queue, yielding LapinMessage deliveries.
RabbitExchange
Describes the exchange side of a RabbitQueue binding.
RabbitQueue
Describes one queue subscription: the queue, its expected settings, and its bindings.
ServerTxPublish
The server-transactional publish policy: same options as LapinPublish, pairing into ServerTxPublisher.
ServerTxPublisher
The live publisher backed by AMQP server transactions (tx.select / tx.commit / tx.rollback).

Enums§

AMQPValue
Enumeration referencing the possible AMQP values depending on the types
AmqpError
Errors returned by LapinBroker and the types it hands out.
Delay
How a subscription handles retry_after / nack_after delays.
QueueType
The queue implementation selected at declaration time.

Constants§

PARTITION_KEY_HEADER
Header carrying a message’s partition key, read by Partitioned for keyed worker lanes.

Traits§

LapinPublishPolicy
A publish policy that pairs with a connected RabbitMQ broker without opening a channel.