Crate dove[][src]

Dove is an open source Rust implementation of the AMQP 1.0 OASIS standard ( The Advanced Message Queuing Protocol (AMQP) is an open standard for passing business messages between applications or organizations. It connects systems, feeds business processes with the information they need and reliably transmits onward the instructions that achieve their goals.

Dove aims to be an AMQP 1.0 implementation with the following properties:

Low footprint - efficient memory usage and pay only for what you use. Portable - minimize the number of dependencies and use portable APIs. The library supports only the basics right now: Establishing connections, creating sessions, links and sending and receiving message. Most AMQP 1.0 types have been implemented, and conversion for many Rust native types exists. Support for SASL ANONYMOUS and PLAIN.

Dove exposes two different APIs:

  • An API for writing messaging applications using async rust.
  • A low level connection API that allows you to send and receive frames defined as rust types.


use dove::container::*;
use futures::executor::block_on;
use testcontainers::{clients, images, Docker};

// Start a broker that we can run the client against.
let docker = clients::Cli::default();
let node =
        .with_env_var("ARTEMIS_USERNAME", "test")
        .with_env_var("ARTEMIS_PASSWORD", "test")
let port: u16 = node.get_host_port(5672).unwrap();

// Create client and connect
let container = Container::new()
    .expect("unable to create container")

// connect creates the TCP connection and sends OPEN frame.
block_on(async {
    let connection = container
        .connect("localhost", port, ConnectionOptions::new()
        .expect("connection not created");

    // new_session creates the AMQP session.
    let session = connection
        .expect("session not created");

    // Create receiver
    let receiver = session
        .expect("receiver not created");

    // Create sender
    let sender = session
        .expect("sender not created");

    //  Send message and get delivery.
    let message = Message::amqp_value(Value::String("Hello, World".to_string()));
    let _ = sender.send(message).await.expect("delivery not received");

    // Receive message. Disposition will be sent in destructor of delivery.
    let delivery = receiver.receive().await.expect("unable to receive message");

    println!("Received: {:?}", delivery.message().body);




The conn module contains basic primitives for establishing and accepting AMQP connections and performing the initial handshake. Once handshake is complete, the connection can be used to send and receive frames.


The container module contains a simple API for creating client connections and sending and receiving messages


Conversion functions for types that is used in this implementation. This is used * when decoding frames. At present there is a lot of duplication, and this part * could use some refactoring to simplify. *


The decoding module contains AMQP 1.0 type decoders and rust native type decoders.


The driver module is an intermediate layer with the core logic for interacting with different AMQP 1.0 endpoint entities (connections, sessions, links).


The encoding module contains AMQP 1.0 type encoders and rust native types encoders.


The error module implements all AMQP 1.0 error types that is supported by dove. Conversion from many different error types are supported.


The frame_codec contains utility types for simplifying frame and composite type encoding and decoding.


The framing module implements the different AMQP 1.0 frame type model, encoder and decoder.


The message module implements the AMQP 1.0 message format encoding and decoding.


The sasl module implements the SASL support in dove.


The symbol module contains symbol type specific code.


The transport module contains the network connectivity transport for the upper layers. It is implemented using mio.


The types module contains the AMQP 1.0 types system encoders and decoders. By using these types you can enforce a certain encoding for your data.


Utility module for working with AMQP 1.0 URLs similar to that supported by Apache Qpid.