bastion-amqp

Crates.iobastion-amqp
lib.rsbastion-amqp
version0.3.0
sourcesrc
created_at2020-06-26 09:59:42.87197
updated_at2022-02-02 20:03:03.081886
descriptionlapin integration with bastion
homepage
repositoryhttps://github.com/amqp-rs/lapin
max_upload_size
id258343
size49,470
Marc-Antoine Perennou (Keruspe)

documentation

https://docs.rs/bastion-amqp

README

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))
}
Commit count: 1832

cargo fmt