#bb8

bb8-lapin

r2d2-lapin, but for async tokio based connections

5 releases (3 breaking)

0.5.0 Mar 28, 2023
0.4.0 Apr 1, 2022
0.3.0 Apr 1, 2022
0.1.1 Oct 4, 2020
0.1.0 Oct 4, 2020

#6 in #bb8

Download history 219/week @ 2024-07-22 334/week @ 2024-07-29 169/week @ 2024-08-05 199/week @ 2024-08-12 186/week @ 2024-08-19 257/week @ 2024-08-26 260/week @ 2024-09-02 309/week @ 2024-09-09 151/week @ 2024-09-16 261/week @ 2024-09-23 328/week @ 2024-09-30 389/week @ 2024-10-07 401/week @ 2024-10-14 375/week @ 2024-10-21 382/week @ 2024-10-28 392/week @ 2024-11-04

1,556 downloads per month

MIT license

15KB
54 lines

docs crates.io-version tests audit crates.io-license

Lapin support for the bb8 connection pool.

Usage

See the documentation of bb8 for the details on how to use the connection pool.

use bb8_lapin::prelude::*;

async fn example() {
    let manager = LapinConnectionManager::new("amqp://guest:guest@127.0.0.1:5672//", ConnectionProperties::default());
    let pool = bb8::Pool::builder()
        .max_size(15)
        .build(manager)
        .await
        .unwrap();
    for _ in 0..20 {
        let pool = pool.clone();
        tokio::spawn(async move {
            let conn = pool.get().await.unwrap();
            // use the connection
            // it will be returned to the pool when it falls out of scope.
        });
    }
}

See files in the examples folder for more examples.

Build-time Requirements

The crate is tested on ubuntu-latest against the nightly and stable rust versions. It is possible that it works with older versions as well but this is not tested. Please see the details of the bb8 and lapin crates about their requirements.

Dependencies

~10–22MB
~322K SLoC