From c6855b5fd38dea77f178eb2baa6c3fe49d347227 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 1 Mar 2018 22:42:01 -0500 Subject: [PATCH] Add some explicit declarations --- ofborg/src/bin/builder.rs | 34 ++++++++++++++++++++++++++++++++++ ofborg/src/bin/stats.rs | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/ofborg/src/bin/builder.rs b/ofborg/src/bin/builder.rs index 538252f..0be9718 100644 --- a/ofborg/src/bin/builder.rs +++ b/ofborg/src/bin/builder.rs @@ -40,6 +40,40 @@ fn main() { let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap(); let mut channel = session.open_channel(1).unwrap(); channel.basic_prefetch(1).unwrap(); + channel + .declare_exchange(easyamqp::ExchangeConfig { + exchange: "build-inputs".to_owned(), + exchange_type: easyamqp::ExchangeType::Fanout, + passive: false, + durable: true, + auto_delete: false, + no_wait: false, + internal: false, + arguments: None, + }) + .unwrap(); + + channel + .declare_queue(easyamqp::QueueConfig { + queue: format!("build-inputs-{}", cfg.nix.system.clone()), + passive: false, + durable: true, + exclusive: false, + auto_delete: false, + no_wait: false, + arguments: None, + }) + .unwrap(); + + channel + .bind_queue(easyamqp::BindQueueConfig { + queue: format!("build-inputs-{}", cfg.nix.system.clone()), + exchange: "build-inputs".to_owned(), + routing_key: None, + no_wait: false, + arguments: None, + }) + .unwrap(); channel .consume( diff --git a/ofborg/src/bin/stats.rs b/ofborg/src/bin/stats.rs index ad3ada0..5762609 100644 --- a/ofborg/src/bin/stats.rs +++ b/ofborg/src/bin/stats.rs @@ -34,13 +34,47 @@ fn main() { ); let mut channel = session.open_channel(1).unwrap(); + channel + .declare_exchange(easyamqp::ExchangeConfig { + exchange: "stats".to_owned(), + exchange_type: easyamqp::ExchangeType::Fanout, + passive: false, + durable: true, + auto_delete: false, + no_wait: false, + internal: false, + arguments: None, + }) + .unwrap(); + + channel + .declare_queue(easyamqp::QueueConfig { + queue: "stats-events".to_owned(), + passive: false, + durable: true, + exclusive: false, + auto_delete: false, + no_wait: false, + arguments: None, + }) + .unwrap(); + + channel + .bind_queue(easyamqp::BindQueueConfig { + queue: "stats-events".to_owned(), + exchange: "stats".to_owned(), + routing_key: None, + no_wait: false, + arguments: None, + }) + .unwrap(); channel.basic_prefetch(1).unwrap(); channel .consume( worker::new(collector), easyamqp::ConsumeConfig { - queue: "sample-stats-events".to_owned(), + queue: "stats-events".to_owned(), consumer_tag: format!("{}-prometheus-stats-collector", cfg.whoami()), no_local: false, no_ack: false,