9 releases

0.3.0 Feb 2, 2022
0.2.3 Nov 21, 2020
0.2.2 Oct 31, 2020
0.2.0 Sep 25, 2020
0.1.2 Jun 30, 2020

#4 in #bastion

MIT license

340KB
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

~13–26MB
~392K SLoC