#rabbitmq #amqp #queue #broker


Typed RabbitMQ interfacing for async Rust

10 releases

0.0.10 Jul 4, 2023
0.0.9 Jun 6, 2023
0.0.8 May 22, 2023
0.0.7 Apr 25, 2023
0.0.4 Mar 21, 2023

#408 in Asynchronous

Download history 83/week @ 2023-06-07 45/week @ 2023-06-14 32/week @ 2023-06-21 59/week @ 2023-06-28 22/week @ 2023-07-05 10/week @ 2023-07-12 5/week @ 2023-07-19 7/week @ 2023-07-26 26/week @ 2023-08-02 23/week @ 2023-08-09 51/week @ 2023-08-16 34/week @ 2023-08-23 17/week @ 2023-08-30 44/week @ 2023-09-06 20/week @ 2023-09-13 29/week @ 2023-09-20

116 downloads per month


1.5K SLoC


crates.io Documentation

Typed RabbitMQ interfacing for async Rust.

This crate defines several types of channels for interfacing with RabbitMQ in various ways:

  • DirectChannel: a channel for publishing messages on direct queues.
  • TopicChannel: a channel for publishing messages on topic exchanges
  • RpcChannel: a channel for publishing messages on direct queues, allowing for receiving replies. It also supports publishing an initial message on a direct queue, and setting up a back-and-forth communincation channel.

RpcChannels currently require the tokio runtime to spawn tasks that receive messages and is therefore behind the rpc feature flag.

Each channel exposes methods to instantiate Publishers and Consumers, each of which are generic over the bus they publish on or consume from. These buses define what types of payload they send, so Publishers and Consumers can take care of serializing and deserializing the payloads and make sure the payloads they publish and yield are of the correct types.

There are several kinds of typed buses, each tied to one of the Channels:

  • DirectBus: a bus that defines a PublishPayload type, a formatter for direct queue names, and the type of argument to that formatter. DirectBuses are used to simply publish messages on a direct queue without expecting any response. DirectBuses are tied to the DirectChannel.
  • TopicBus: a bus that defines a PublishPayload type, a topic, and an Exchange. TopicBuses are used to publish and consume messages from a topic exchange. TopicBuses are tied to the TopicChannel.
  • RpcBus: act like a DirectBus, but further defines a ReplyPayload type and allows for awaiting replies on sent messages. RpcBuses are tied to the RpcChannel
  • RpcCommBus: a bus that defines InitialPayload, BackPayload and ForthPayload, and support flows where a single initial message is sent, after which back-and-forth a communication over which multiple messages can be sent is setup. RpcCommBuses are tied to the RpcChannel


~346K SLoC