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
//! AMQP 0-9-1 client implementation compatible with RabbitMQ.
//!
//! It is currently based on async tokio runtime, and cannot be configured to use another runtime by user.
//!
//! User usually starts by openning an AMQP [`Connection`] and register the connection [`callbacks`],
//! then open an AMQP [`Channel`] on the connection and register the channel [`callbacks`].
//!
//!
//! # Quick Start
//!
//! ```rust
//! use amqprs::{
//! callbacks,
//! security::SecurityCredentials,
//! connection::{OpenConnectionArguments, Connection},
//! };
//!
//! # #[tokio::main]
//! # async fn main() {
//! // Build arguments for new connection.
//! let args = OpenConnectionArguments::new("localhost", 5672, "user", "bitnami");
//! // Open an AMQP connection with given arguments.
//! let connection = Connection::open(&args).await.unwrap();
//!
//! // Register connection level callbacks.
//! // In production, user should create its own type and implement trait `ConnectionCallback`.
//! connection.register_callback(callbacks::DefaultConnectionCallback).await.unwrap();
//!
//! // ... Now, ready to use the connection ...
//!
//! // Open an AMQP channel on this connection.
//! let channel = connection.open_channel(None).await.unwrap();
//! // Register channel level callbacks.
//! // In production, user should create its own type and implement trait `ChannelCallback`.
//! channel.register_callback(callbacks::DefaultChannelCallback).await.unwrap();
//!
//! // ... Now, ready to use the channel ...
//! // For examples:
//! channel.flow(true).await.unwrap();
//!
//! // gracefully shutdown.
//! channel.close().await.unwrap();
//! connection.close().await.unwrap();
//! # }
//! ```
//!
//! # Optional Features
//!
//! - "traces": enable `tracing` in the library.
//! - "compliance_assert": enable compliance assertion according to AMQP spec.
//! If enabled, library always check user inputs and `panic` if any non-compliance.
//! If disabled, then it relies on server to reject.
//! - "tls": enable SSL/TLS.
//! - "urispec": enable support of [RabbitMQ URI Specification](https://www.rabbitmq.com/uri-spec.html)
//!
//! [`Connection`]: connection/struct.Connection.html
//! [`Channel`]: channel/struct.Channel.html
//! [`callbacks`]: callbacks/index.html
//!
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/// public API and types
pub use *;
pub use Ack;
pub use BasicProperties;
pub use Cancel;
pub use Close;
pub use CloseChannel;
pub use Deliver;
pub use GetOk;
pub use Nack;
pub use Return;
pub use DELIVERY_MODE_PERSISTENT;
pub use DELIVERY_MODE_TRANSIENT;
pub use *;