[−][src]Crate amqp
#rust-amqp [](https: //travis-ci.org/Antti/rust-amqp)
AMQ protocol implementation in pure rust.
Note: The project is still in very early stages of development, it implements all the protocol parsing, but not all the protocol methods are wrapped/easy to use. Expect the API to be changed in the future.
What it currently can do:
Connect to server Open/close channels Declare queues/exchanges All the methods from the Basic class are implemented, including get, publish, ack, nack, reject, consume. So you can send/receive messages.
Have a look at the examples in examples folder.
Connecting to the server & openning channel:
Note: Currently it can't connect using TLS connections.
use amqp::session::Session; use amqp::table; let mut session = Session::open_url("amqp://localhost/").unwrap(); let mut channel = session.open_channel(1).unwrap();
Declaring queue:
use amqp::table; The arguments come in following order: queue: &str, passive: bool, durable: bool, exclusive: bool, auto_delete: bool, nowait: bool, arguments: Table let queue_declare = channel.queue_declare("my_queue_name", false, true, false, false, false, table::new());
Publishing message:
channel.basic_publish("", "my_queue_name", true, false, amqp::protocol::basic::BasicProperties{ content_type: Some("text".to_string()), ..Default::default()}, (b"Hello from rust!").to_vec());
This will send message: "Hello from rust!" to the queue named "my_queue_name".
The messages have type of Vec
Development notes:
The methods encoding/decoding code is generated using codegen.rb & amqp-rabbitmq-0.9.1.json spec.
To generate a new spec, run:
make
To build project, use cargo:
cargo build
To build examples:
cargo test
Modules
protocol |
Structs
Channel | |
ConsumeBuilder | |
GetResult | |
Options | |
QueueBuilder | |
Session |
Enums
AMQPError | |
AMQPScheme | |
TableEntry |
Constants
VERSION |
Traits
Basic | |
Consumer |
Type Definitions
Table |