Crates.io | bastion-amqp |
lib.rs | bastion-amqp |
version | 0.3.0 |
source | src |
created_at | 2020-06-26 09:59:42.87197 |
updated_at | 2022-02-02 20:03:03.081886 |
description | lapin integration with bastion |
homepage | |
repository | https://github.com/amqp-rs/lapin |
max_upload_size | |
id | 258343 |
size | 49,470 |
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))
}