Expand description
lapin-futures-tls-api
This library offers a nice integration of tls-api with the lapin-futures library.
It uses amq-protocol URI parsing feature and adds the connect and connect_cancellable
methods to AMQPUri which will provide you with a lapin_futures::client::Client and
optionally a lapin_futures::client::HeartbeatHandle wrapped in a Future.
It autodetects whether you’re using amqp or amqps and opens either a raw TcpStream
or a TlsStream using tls-api as the SSL api.
§Connecting and opening a channel
use env_logger;
use failure::Error;
use futures::future::Future;
use lapin_futures_tls_api::{AMQPConnectionTlsApiExt, lapin};
use lapin::channel::ConfirmSelectOptions;
use tokio;
fn main() {
env_logger::init();
tokio::run(
"amqps://user:pass@host/vhost?heartbeat=10".connect_cancellable::<tls_api_stub::TlsConnector, _>(|err| {
eprintln!("heartbeat error: {:?}", err);
}).map_err(Error::from).and_then(|(client, heartbeat_handle)| {
println!("Connected!");
client.create_confirm_channel(ConfirmSelectOptions::default()).map(|channel| (channel, heartbeat_handle)).and_then(|(channel, heartbeat_handle)| {
println!("Stopping heartbeat.");
heartbeat_handle.stop();
println!("Closing channel.");
channel.close(200, "Bye")
}).map_err(Error::from)
}).map_err(|err| {
eprintln!("amqp error: {:?}", err);
})
);
}Modules§
- error
Deprecated - Reexport of the
lapin_futures_tls_internalerrors - lapin
Deprecated - Reexport of the
lapin_futurescrate - uri
Deprecated - Reexport of the
urimodule from theamq_protocolcrate
Traits§
- AMQP
Connection TlsApi Ext Deprecated - Add a connect method providing a
lapin_futures::client::Clientwrapped in aFuture.
Type Aliases§
- AMQP
Stream Deprecated - Reexport of
AMQPStream