28 releases (5 stable)

Uses new Rust 2021

2.0.0 Feb 2, 2022
1.1.0 Jan 30, 2022
1.0.0 Dec 23, 2020
0.3.1 Nov 21, 2020
0.1.3 Jun 26, 2020

#5 in #amqp0-9-1

Download history 2816/week @ 2022-04-23 3028/week @ 2022-04-30 2890/week @ 2022-05-07 2276/week @ 2022-05-14 1827/week @ 2022-05-21 2004/week @ 2022-05-28 2234/week @ 2022-06-04 1452/week @ 2022-06-11 1465/week @ 2022-06-18 1879/week @ 2022-06-25 1342/week @ 2022-07-02 1635/week @ 2022-07-09 1572/week @ 2022-07-16 1746/week @ 2022-07-23 1813/week @ 2022-07-30 1562/week @ 2022-08-06

6,986 downloads per month
Used in 13 crates (12 directly)

MIT license

335KB
9K SLoC

Lapin integration with tokio

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

use tokio_amqp::*;
use lapin::{Connection, ConnectionProperties, Result};
use std::sync::Arc;
use tokio::runtime::Runtime;

async fn tokio_main() -> Result<()> {
    let addr = std::env::var("AMQP_ADDR").unwrap_or_else(|_| "amqp://127.0.0.1:5672/%2f".into());
    let conn = Connection::connect(&addr, ConnectionProperties::default().with_tokio()).await?; // Note the `with_tokio()` here
    let channel = conn.create_channel().await?;

    // Rest of your program
}

fn main() {
    let rt = Runtime::new().expect("failed to create runtime");
    rt.block_on(tokio_main()).expect("error");
}

Dependencies

~7–14MB
~268K SLoC