8 releases

0.2.3 Nov 21, 2020
0.2.2 Oct 31, 2020
0.2.0 Sep 25, 2020
0.1.3 Aug 27, 2020
0.1.2 Jun 30, 2020

#18 in #rabbitmq

43 downloads per month

MIT license

335KB
9K SLoC

Lapin integration with bastion

This crate integrates lapin with bastin by using bastion's executor inside of lapin for its internal operations and for consumer delegates.

use bastion_amqp::*;
use bastion::run;
use lapin::{Connection, ConnectionProperties, Result};

pub async fn consumer(addr: String) -> Result<()> {
    let conn = Connection::connect(&addr, ConnectionProperties::default().with_bastion()).await?; // Note the `with_bastion()` here
    let channel = conn.create_channel().await?;
    // Rest of your program
}

fn main() -> Result<()> {
    Bastion::init();
    Bastion::start();

    let addr = std::env::var("AMQP_ADDR").unwrap_or_else(|_| "amqp://127.0.0.1:5672/%2f".into());
    run!(consumer(addr))
}

Dependencies

~8MB
~176K SLoC