1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Copyright 2019, Ulf Lilleengen
 * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
 */

//! Dove is an open source Rust implementation of the AMQP 1.0 OASIS standard (http://www.amqp.org/). 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.

//! # Example
//!
//! ```ignore
//! use dove::container::*;
//! use futures::executor::block_on;
//! use testcontainers::{clients, images, Docker};
//! env_logger::init();
//!
//! // Start a broker that we can run the client against.
//! let docker = clients::Cli::default();
//! let node = docker.run(
//!     images::generic::GenericImage::new("docker.io/vromero/activemq-artemis:2-latest")
//!         .with_env_var("ARTEMIS_USERNAME", "test")
//!         .with_env_var("ARTEMIS_PASSWORD", "test")
//! );
//! std::thread::sleep(std::time::Duration::from_millis(30000));
//! let port: u16 = node.get_host_port(5672).unwrap();
//!
//! // Create client and connect
//! let container = Container::new()
//!     .expect("unable to create container")
//!     .start();
//!
//! // connect creates the TCP connection and sends OPEN frame.
//! block_on(async {
//!     let connection = container
//!         .connect("localhost", port, ConnectionOptions::new()
//!             .sasl_mechanism(SaslMechanism::Plain)
//!             .username("test")
//!             .password("test"))
//!         .await
//!         .expect("connection not created");
//!
//!     // new_session creates the AMQP session.
//!     let session = connection
//!         .new_session(None)
//!         .await
//!         .expect("session not created");
//!
//!     // Create receiver
//!     let receiver = session
//!         .new_receiver("queue1")
//!         .await
//!         .expect("receiver not created");
//!
//!     // Create sender
//!     let sender = session
//!         .new_sender("queue1")
//!         .await
//!         .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);
//!
//! });
//! ```
pub mod conn;
pub mod container;
pub mod convert;
pub mod decoding;
pub mod driver;
pub mod encoding;
pub mod error;
pub mod frame_codec;
pub mod framing;
pub mod message;
pub mod sasl;
pub mod symbol;
pub mod transport;
pub mod types;
pub mod url;