Rabbit auto uses https://github.com/CleverCloud/lapin.
The library provides a consumer and a publisher, which after the first successful connection run until manually closed. In case of loosing connection to RabbitMQ, they wait until the connection is reestablished without failing.
The current async runtime used is tokio, but it can be easily extended (in the library code) to use different ones.
use rabbit_auto::publisher::{Serialise, PublishWrapper, simple_confirm_options};
use rabbit_auto::comms::Comms;
use rabbit_auto::config::Config;
Comms::configure(Config::new("rabbit-host-ip", "rabbit user", "rabbit password",
Duration::from_secs(3)).await;
let publisher = PublishWrapper::<(MsgOut, String), _>::with_dynamic_key(
"the exchange",
Some(simple_confirm_options()),
None, None, ).await;
let publisher = PublishWrapper::<MsgOut, _>::with_static_key(
"the exchange",
"the routing key",
Some(simple_confirm_options()),
None, None, ).await;
let consumer = StreamBuilder {
tag: "the app id",
routing_key: "the routing key",
exchange: "the exchange",
..StreamBuilder::default()}
.create_auto_ack().await;