forked from the-distro/ofborg
clippy: Action::Publish(QueueMsg box contenst
This commit is contained in:
parent
63fcd856da
commit
053ea863e0
|
@ -72,11 +72,11 @@ impl<'a> NotificationReceiver for ChannelNotificationReceiver<'a> {
|
||||||
.basic_nack(self.delivery_tag, false, false)
|
.basic_nack(self.delivery_tag, false, false)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
Action::Publish(msg) => {
|
Action::Publish(mut msg) => {
|
||||||
let exch = msg.exchange.clone().unwrap_or_else(|| "".to_owned());
|
let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned());
|
||||||
let key = msg.routing_key.clone().unwrap_or_else(|| "".to_owned());
|
let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned());
|
||||||
|
|
||||||
let props = msg.properties.unwrap_or(BasicProperties {
|
let props = msg.properties.take().unwrap_or(BasicProperties {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
self.channel
|
self.channel
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub enum Action {
|
||||||
Ack,
|
Ack,
|
||||||
NackRequeue,
|
NackRequeue,
|
||||||
NackDump,
|
NackDump,
|
||||||
Publish(QueueMsg),
|
Publish(Box<QueueMsg>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
@ -44,14 +44,14 @@ where
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
Action::Publish(QueueMsg {
|
Action::Publish(Box::new(QueueMsg {
|
||||||
exchange,
|
exchange,
|
||||||
routing_key,
|
routing_key,
|
||||||
mandatory: false,
|
mandatory: false,
|
||||||
immediate: false,
|
immediate: false,
|
||||||
properties: Some(props),
|
properties: Some(props),
|
||||||
content: serde_json::to_string(&msg).unwrap().into_bytes(),
|
content: serde_json::to_string(&msg).unwrap().into_bytes(),
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait SimpleWorker: Send + 'static {
|
pub trait SimpleWorker: Send + 'static {
|
||||||
|
@ -102,11 +102,11 @@ impl<T: SimpleWorker + Send> Consumer for Worker<T> {
|
||||||
.basic_nack(method.delivery_tag, false, false)
|
.basic_nack(method.delivery_tag, false, false)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
Action::Publish(msg) => {
|
Action::Publish(mut msg) => {
|
||||||
let exch = msg.exchange.clone().unwrap_or_else(|| "".to_owned());
|
let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned());
|
||||||
let key = msg.routing_key.clone().unwrap_or_else(|| "".to_owned());
|
let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned());
|
||||||
|
|
||||||
let props = msg.properties.unwrap_or(BasicProperties {
|
let props = msg.properties.take().unwrap_or(BasicProperties {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
channel
|
channel
|
||||||
|
|
Loading…
Reference in a new issue