async-lapin

Crates.ioasync-lapin
lib.rsasync-lapin
version2.0.0
sourcesrc
created_at2020-07-20 08:48:29.880482
updated_at2022-02-02 20:00:57.739707
descriptionlapin integration with async-io
homepage
repositoryhttps://github.com/amqp-rs/lapin
max_upload_size
id267150
size38,619
Marc-Antoine Perennou (Keruspe)

documentation

https://docs.rs/async-lapin

README

Lapin integration with async-io

This crate integrates lapin with async-io by using async-io's reactor inside of lapin.

use async_lapin::*;
use lapin::{executor::Executor, Connection, ConnectionProperties, Result};
use std::{future::Future, pin::Pin};

fn main() -> Result<()> {
    async_global_executor::block_on(async {
        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_async_io(SmolExecutor)
        )
        .await?; // Note the `with_async_io()` here
        let channel = conn.create_channel().await?;

        // Rest of your program
    })
}
Commit count: 1832

cargo fmt