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

#63 in #rabbitmq

Download history 1579/week @ 2023-11-25 1044/week @ 2023-12-02 1730/week @ 2023-12-09 1559/week @ 2023-12-16 1302/week @ 2023-12-23 1062/week @ 2023-12-30 1234/week @ 2024-01-06 1871/week @ 2024-01-13 1711/week @ 2024-01-20 1568/week @ 2024-01-27 1435/week @ 2024-02-03 1217/week @ 2024-02-10 1296/week @ 2024-02-17 1423/week @ 2024-02-24 1415/week @ 2024-03-02 1133/week @ 2024-03-09

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

MIT license

340KB
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–23MB
~339K SLoC