feat: env var to control rabbitmq event ingress

Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
Zomatree
2026-03-15 19:31:04 +00:00
parent 5a6155fdb6
commit 805f2c4528

View File

@@ -56,6 +56,7 @@ async fn main() {
set_rabbitmq_connection(rmq_conn.clone());
if std::env::var("ENABLE_RABBITMQ_INGRESS").as_deref().is_ok_and(|v| v == "1") {
let channel = rmq_conn
.open_channel(None)
.await
@@ -68,17 +69,17 @@ async fn main() {
.finish(),
)
.await
.expect("wires");
.expect("Failed to declare exchange");
channel
.queue_declare(QueueDeclareArguments::new("events").durable(true).finish())
.await
.expect("wires 2");
.expect("Failed to declare queue");
channel
.queue_bind(QueueBindArguments::new("events", "events", "events"))
.await
.expect("wires 3");
.expect("Failed to bind queue");
channel
.basic_consume(
@@ -88,7 +89,8 @@ async fn main() {
.finish(),
)
.await
.expect("wires 4");
.expect("Failed to consume channel");
}
// Start accepting new connections and spawn a client for each connection.
while let Ok((stream, addr)) = listener.accept().await {