Expand description
ramqp — a from-scratch, clean-room AMQP 1.0 client.
This crate implements the OASIS AMQP 1.0 specification from scratch with no
external AMQP dependencies: the entire type/encoding layer (codec,
types) and the async runtime (transport → connection → session → link →
public API → resilience) are built here on top of generic building blocks
(bytes, tokio, futures).
§Design pillars
- Single-pass, zero-copy framing. Bodies are exposed as
bytes::Bytesslices; transfer/body splitting is computed once from the negotiatedmax-frame-sizerather than by trial re-serialization. - Lock-free actor runtime. One owning driver task per connection holds all protocol state; user handles are cheap clones that exchange messages.
- Flat, classified errors. One error enum per public operation with a
source()chain and retry classification. - Pluggable observability. A
Metricstrait and a connection-eventstream, usable withouttracing.
The crate is #![forbid(unsafe_code)].
Re-exports§
pub use api::Connection;pub use api::ConnectionBuilder;pub use api::Consumer;pub use api::Producer;pub use api::Session;pub use resilience::Pool;pub use resilience::PoolBuilder;pub use transport::TlsConfig;
Modules§
- api
- Public API (Phase 5): the
Client/Connection/Sessionentry points andProducer/Consumerhandles, plus graceful lifecycle. - codec
- Clean-room AMQP 1.0 type system and wire codec (Phase E).
- config
- Configuration structs and presets (WP-0.3).
- connection
- Connection runtime: the client’s single-owner driver task, built on the
role-neutral negotiation/mux/heartbeat helpers from
ramqp-core. - error
- The flat, classified error model (WP-0.1, decision D-4).
- ids
- Identifier newtypes (WP-0.2).
- link
- Link runtime (Phase 4): sender/receiver state machines, owner-local settlement tracking, credit/flow control, delivery assembly, and recovery.
- observe
- Observability contracts (Phase 0, WP-0.4): a pluggable
Metricstrait and a connectioneventstream, usable without thetracingecosystem. - proto
- Internal protocol command/event enums — the “alphabet” the actor layers exchange over channels (WP-0.5).
- resilience
- Resilience (Phase 6): the reconnect supervisor and the connection pool.
- sasl
- SASL authentication (WP-1.4): the client-side negotiation state machine and
the ANONYMOUS / PLAIN / EXTERNAL mechanisms, plus SCRAM-SHA-1/256/512 behind
the
scramfeature. - session
- Session runtime (Phase 3): begin/end state, flow-control windows, and the handle↔link registry.
- transport
- Transport layer: dial-side connectors (TCP, TLS, WebSocket) over the
role-neutral byte-stream/framing layer re-exported from
ramqp-core. - txn
- Transaction controller (clean-room, AMQP 1.0 spec part 4), behind the
transactionfeature. - types
- Clean-room AMQP 1.0 protocol types (Phase E), built on
crate::codec.
Macros§
- amqp_
composite - Define an AMQP composite (described-list) type with its
EncodeandDecodeimplementations from a concise field list.
Structs§
- Config
- The full configuration bundle.
- Delivery
- A received delivery. The body is exposed as raw
Bytesby default; typed access is opt-in (the inversion offe2o3-amqp’s eager-deserialize default). - Message
- A complete AMQP message: optional annotation/header/property sections, a body, and an optional footer.