implement binding

This commit is contained in:
nora 2022-03-26 13:02:39 +01:00
parent 6f6c0848ac
commit a1fa68396f
9 changed files with 181 additions and 77 deletions

View file

@ -46,11 +46,9 @@ impl Borrow<str> for ExchangeName {
pub struct Exchange {
pub name: ExchangeName,
pub kind: ExchangeType,
pub durable: bool,
}
#[derive(Debug)]
pub struct Binding {}
pub fn default_exchanges() -> HashMap<ExchangeName, Exchange> {
// 3.1.3 - The spec requires a few default exchanges to exist
@ -60,6 +58,7 @@ pub fn default_exchanges() -> HashMap<ExchangeName, Exchange> {
kind: ExchangeType::Direct {
bindings: HashMap::new(),
},
durable: true,
};
let direct_name = ExchangeName::new("amqp.direct".to_owned().into());
@ -68,6 +67,7 @@ pub fn default_exchanges() -> HashMap<ExchangeName, Exchange> {
kind: ExchangeType::Direct {
bindings: HashMap::new(),
},
durable: true,
};
let fanout_name = ExchangeName::new("amqp.fanout".to_owned().into());
@ -76,6 +76,7 @@ pub fn default_exchanges() -> HashMap<ExchangeName, Exchange> {
kind: ExchangeType::Fanout {
bindings: Vec::new(),
},
durable: true,
};
let topic_name = ExchangeName::new("amqp.topic".to_owned().into());
@ -84,6 +85,7 @@ pub fn default_exchanges() -> HashMap<ExchangeName, Exchange> {
kind: ExchangeType::Topic {
bindings: Vec::new(),
},
durable: true,
};
// we don't implement headers (yet), so don't provide the default exchange for it