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

@ -1,7 +1,6 @@
use std::sync::Arc;
use haesli_core::{
amqp_todo,
connection::Channel,
error::{ChannelException, ConException},
message::Message,
@ -18,21 +17,17 @@ pub fn publish(channel_handle: Channel, message: Message) -> Result<()> {
let routing = &message.routing;
if !routing.exchange.is_empty() {
amqp_todo!();
}
let global_data = global_data.lock();
let exchange = &message.routing.exchange;
let exchange = &routing.exchange;
let exchange = global_data
.exchanges
.get(exchange.as_str())
.ok_or(ChannelException::NotFound)?;
let queues = routing::route_message(exchange, &message.routing.routing_key)
.ok_or(ChannelException::NotFound)?; // todo this isn't really correct but the tests pass ✔️
let queues =
routing::route_message(exchange, &routing.routing_key).ok_or(ChannelException::NotFound)?; // todo this isn't really correct but the tests pass ✔️
for queue in queues {
queue