mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-16 20:55:03 +01:00
more things
This commit is contained in:
parent
5d127eceee
commit
b6355f5e35
11 changed files with 129 additions and 122 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::Result;
|
||||
use amqp_core::{
|
||||
amqp_todo,
|
||||
connection::{Channel, QueuedMethod},
|
||||
connection::{Channel, ConnectionEvent},
|
||||
error::ChannelException,
|
||||
message::Message,
|
||||
methods::{BasicPublish, Method},
|
||||
|
|
@ -31,19 +31,24 @@ pub async fn publish(channel_handle: Channel, message: Message) -> Result<()> {
|
|||
// consuming is hard, but this should work *for now*
|
||||
let consumers = queue.consumers.lock();
|
||||
if let Some(consumer) = consumers.first() {
|
||||
let method = Method::BasicPublish(BasicPublish {
|
||||
let method = Box::new(Method::BasicPublish(BasicPublish {
|
||||
reserved_1: 0,
|
||||
exchange: routing.exchange.clone(),
|
||||
routing_key: routing.routing_key.clone(),
|
||||
mandatory: false,
|
||||
immediate: false,
|
||||
});
|
||||
}));
|
||||
|
||||
consumer.channel.queue_method(QueuedMethod::WithContent(
|
||||
method,
|
||||
message.header.clone(),
|
||||
message.content.clone(),
|
||||
));
|
||||
consumer
|
||||
.channel
|
||||
.event_sender
|
||||
.try_send(ConnectionEvent::MethodContent(
|
||||
consumer.channel.num,
|
||||
method,
|
||||
message.header.clone(),
|
||||
message.content.clone(),
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue