28 releases (5 stable)

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

#67 in #rabbitmq

Download history 1961/week @ 2024-05-22 1954/week @ 2024-05-29 1531/week @ 2024-06-05 1778/week @ 2024-06-12 1440/week @ 2024-06-19 1293/week @ 2024-06-26 1098/week @ 2024-07-03 1247/week @ 2024-07-10 1231/week @ 2024-07-17 1405/week @ 2024-07-24 1165/week @ 2024-07-31 1497/week @ 2024-08-07 1785/week @ 2024-08-14 1180/week @ 2024-08-21 1107/week @ 2024-08-28 906/week @ 2024-09-04

5,270 downloads per month
Used in fewer than 10 crates

MIT license

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

~10–24MB
~342K SLoC