AMQP 0-9-1

hopf-amqp is an AMQP 0-9-1 async client (RabbitMQ wire protocol). Client-only: publish opaque bodies and consume via push basic.consume deliveries on the Hopf TPC runtime. There is no broker in this crate. For the unrelated AMQP 1.0 wire protocol, see AMQP 1.0 (hopf-amqp1) — the two share only the AMQP magic bytes.

Scope

AreaSupport
ProtocolAMQP 0-9-1 only — see AMQP 1.0 for the separate hopf-amqp1 crate
RoleClient only
AuthPLAIN (via hopf-auth) or AMQPLAIN
ChannelsMulti-channel; control methods take channel_id
Publishbasic.publish + content frames, publisher confirms, basic.return
Consumebasic.consume push deliveries (not basic.get)
TLSAMQPS via implicit TLS on dial

Architecture

AmqpClient::connect
    → Runtime::connect(TcpConnectorConfig)
    → AmqpClientEndpoint (ProtocolHandler)
         protocol header → connection.start/start-ok
         → tune/tune-ok → open/open-ok
         → AmqpClientDriver::on_connection_open
         → channel / topology / basic.* via AmqpClientControl
         ← basic.deliver + content → on_delivery_start/data/complete

Inbound is reactor-driven: socket readable → receive → AmqpFrameParser → driver callbacks. There is no application poll loop.

Client

SPI mirrors MQTT: AmqpClient facade, AmqpClientHandlerFactory, flat AmqpClientDriver / AmqpClientControl.

AmqpClient::new("127.0.0.1", 5672)
    .credentials("guest", "guest")
    .connect(&rt, Arc::new(Factory))?;

On on_connection_open, open a channel (≥ 1), then declare topology, confirm_select, basic_publish, and/or basic_consume.

Messages

Bodies are opaque octets. Basic properties (content-type, content-encoding, headers, delivery-mode, correlation-id, …) travel in the content header; MIME values are conventional, not enforced by the protocol.

Examples

cargo run -p amqp-pub -- 127.0.0.1 5672 demo.queue "hello from hopf"
cargo run -p amqp-consume -- 127.0.0.1 5672 demo.queue

Opt-in broker test: cargo test -p hopf-amqp --features integration.

Limitations