| Crates.io | lapin-async-global-executor |
| lib.rs | lapin-async-global-executor |
| version | 3.0.0 |
| created_at | 2020-08-27 15:33:47.179139+00 |
| updated_at | 2022-02-02 20:02:27.064844+00 |
| description | lapin integration with async-global-executor |
| homepage | |
| repository | https://github.com/amqp-rs/lapin |
| max_upload_size | |
| id | 281501 |
| size | 39,714 |
This crate integrates lapin with async-global-executor by using its executor inside of lapin for its internal operations and for consumer delegates.
use lapin_async_global_executor::*;
use lapin::{Connection, ConnectionProperties, Result};
fn main() -> Result<()> {
async_global_executor::run(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_global_executor()).await?; // Note the `with_async_global_executor()` here
let channel = conn.create_channel().await?;
// Rest of your program
})
}