Expand description
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
use amqprs::{
callbacks,
security::SecurityCredentials,
connection::{OpenConnectionArguments, Connection},
};
// 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
Modules§
- callbacks
- public API and types
Callback interfaces of asynchronous message for
Connection
andChannel
. - channel
- public API and types Implementation of AMQP_0-9-1’s Channel class compatible with RabbitMQ.
- connection
- public API and types Implementation of AMQP_0-9-1’s Connection class compatible with RabbitMQ.
- consumer
- public API and types Callback interfaces of asynchronous content data consumer.
- error
- public API and types Error type can be returned by the APIs.
- security
- public API and types This module provides configuration API of Security and Access Control.
- tls
- public API and types This module provides TLS adaptor.
Structs§
- Ack
- Used by channel
publish_ack
callback. - Basic
Properties - AMQP message properties.
- Byte
Array - AMQP byte array type.
- Cancel
- Used by channel
cancel
callback. - Close
- Used by connection’s
close
callback. - Close
Channel - Used by channel
close
callback. - Decimal
Value - AMQP decimal type.
- Deliver
- Used by consumer
consume
callback. - Field
Array - AMQP field array type.
- Field
Table - AMQP field table type.
- GetOk
- Part of
GetMessage
- LongStr
- AMQP long string type.
- Nack
- Used by channel
publish_nack
callback. - Return
- Used by channel
publish_return
callback. - Short
Str - AMQP short string type.
Enums§
- Field
Value - AMQP field value type.
Constants§
- DELIVERY_
MODE_ PERSISTENT - Delivery Mode: persistent
- DELIVERY_
MODE_ TRANSIENT - Delivery Mode: transient/non-persistent
Type Aliases§
- Amqp
Channel Id - Note: it is different from definition in
RabbitMQ Definition
. - Amqp
Class Id - Amqp
Consumer Tag - Amqp
Delivery Tag - Amqp
Destination - Amqp
Duration - Amqp
Exchange Name - Amqp
Message Count - Amqp
Method Id - Amqp
Offset - Amqp
Path - Amqp
Peer Properties - Amqp
Queue Name - Amqp
Reference - Amqp
Reject Code - Amqp
Reject Text - Amqp
Reply Code - Amqp
Reply Text - Amqp
Security Token - Amqp
Table - Amqp
Time Stamp - Bit
- DO NOT USE. No primitive rust type to represent single bit.
- Boolean
- Double
- Field
Name - Float
- LongInt
- Long
Long Int - Long
Long Uint - Long
Uint - Octect
- Short
Int - Short
Short Int - Short
Short Uint - Short
Uint - Time
Stamp