mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-14 19:55:03 +01:00
queuing things
This commit is contained in:
parent
2fe3b4b77b
commit
770762b920
16 changed files with 102 additions and 13 deletions
|
|
@ -7,6 +7,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
amqp_core = { path = "../amqp_core" }
|
||||
amqp_datastructure = { path = "../amqp_datastructure" }
|
||||
parking_lot = "0.12.0"
|
||||
tracing = "0.1.31"
|
||||
tokio = { version = "1.17.0", features = ["full"] }
|
||||
|
|
|
|||
|
|
@ -4,13 +4,10 @@ mod queue;
|
|||
|
||||
use crate::Result;
|
||||
use amqp_core::{amqp_todo, connection::Channel, message::Message, methods::Method};
|
||||
use tracing::{error, info};
|
||||
use tracing::info;
|
||||
|
||||
pub fn handle_basic_publish(channel_handle: Channel, message: Message) {
|
||||
match publish::publish(channel_handle, message) {
|
||||
Ok(()) => {}
|
||||
Err(err) => error!(%err, "publish error occurred"),
|
||||
}
|
||||
pub fn handle_basic_publish(channel_handle: Channel, message: Message) -> Result<()> {
|
||||
publish::publish(channel_handle, message)
|
||||
}
|
||||
|
||||
pub async fn handle_method(channel_handle: Channel, method: Method) -> Result<Method> {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ pub fn declare(channel: Channel, queue_declare: QueueDeclare) -> Result<Method>
|
|||
let queue = Arc::new(QueueInner {
|
||||
id,
|
||||
name: queue_name.clone(),
|
||||
messages: Mutex::default(),
|
||||
messages: amqp_datastructure::MessageQueue::new(),
|
||||
durable,
|
||||
exclusive: exclusive.then(|| channel.id),
|
||||
deletion: if auto_delete {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@ impl QueueTask {
|
|||
}
|
||||
|
||||
#[tracing::instrument(skip(self), fields(name = self.show_name()), level = "trace")]
|
||||
async fn queue_message(&mut self, _message: Message) {}
|
||||
async fn queue_message(&mut self, message: Message) {
|
||||
self.queue.messages.append(message);
|
||||
}
|
||||
|
||||
async fn cleanup(&mut self) {
|
||||
// do stuff or something like that id whatever
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue