deprecated tokio-amqp

lapin integration with tokio

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
Download history 1190/week @ 2024-07-20 1451/week @ 2024-07-27 1181/week @ 2024-08-03 1887/week @ 2024-08-10 1371/week @ 2024-08-17 1083/week @ 2024-08-24 1230/week @ 2024-08-31 1178/week @ 2024-09-07 1363/week @ 2024-09-14 1620/week @ 2024-09-21 1401/week @ 2024-09-28 1085/week @ 2024-10-05 1236/week @ 2024-10-12 1442/week @ 2024-10-19 1451/week @ 2024-10-26 1415/week @ 2024-11-02

5,627 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

~11–22MB
~322K SLoC