lapin-futures-openssl 0.5.0

Integration of openssl with lapin-futures


This library offers a nice integration of openssl 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 SslStream using openssl as the SSL engine.

Connecting and opening a channel

extern crate env_logger;
extern crate futures;
extern crate lapin_futures_openssl;
extern crate tokio;

use lapin_futures_openssl::lapin;

use futures::future::Future;
use lapin::channel::ConfirmSelectOptions;
use lapin_futures_openssl::AMQPConnectionOpensslExt;

fn main() {

        "amqps://user:pass@host/vhost?heartbeat=10".connect_cancellable(|err| {
            eprintln!("heartbeat error: {:?}", err);
        }).and_then(|(client, heartbeat_handle)| {
            client.create_confirm_channel(ConfirmSelectOptions::default()).map(|channel| (channel, heartbeat_handle))
        }).and_then(|(channel, heartbeat_handle)| {
            println!("Stopping heartbeat.");
            println!("Closing channel.");
            channel.close(200, "Bye")
        }).map_err(|err| {
            eprintln!("amqp error: {:?}", err);