forked from the-distro/ofborg
make messages persistent
Should ensure we don't loose pending builds or evaluations when rabbitmq restarts.
This commit is contained in:
parent
7d1014f1c2
commit
3223f32f5c
|
@ -190,13 +190,19 @@ async fn action_deliver(
|
||||||
let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned());
|
let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned());
|
||||||
log::debug!("action publish {}", exch);
|
log::debug!("action publish {}", exch);
|
||||||
|
|
||||||
|
let mut props = BasicProperties::default().with_delivery_mode(2); // persistent.
|
||||||
|
|
||||||
|
if let Some(s) = msg.content_type {
|
||||||
|
props = props.with_content_type(s.into());
|
||||||
|
}
|
||||||
|
|
||||||
let _confirmaton = chan
|
let _confirmaton = chan
|
||||||
.basic_publish(
|
.basic_publish(
|
||||||
&exch,
|
&exch,
|
||||||
&key,
|
&key,
|
||||||
BasicPublishOptions::default(),
|
BasicPublishOptions::default(),
|
||||||
msg.content,
|
msg.content,
|
||||||
BasicProperties::default(),
|
props,
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
@ -82,6 +82,7 @@ impl<'a> NotificationReceiver for ChannelNotificationReceiver<'a> {
|
||||||
|
|
||||||
let props = BasicProperties {
|
let props = BasicProperties {
|
||||||
content_type: msg.content_type,
|
content_type: msg.content_type,
|
||||||
|
delivery_mode: Some(2), // persistent
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
self.channel
|
self.channel
|
||||||
|
|
|
@ -104,6 +104,7 @@ impl<T: SimpleWorker + Send> amqp::Consumer for Worker<T> {
|
||||||
|
|
||||||
let props = BasicProperties {
|
let props = BasicProperties {
|
||||||
content_type: msg.content_type,
|
content_type: msg.content_type,
|
||||||
|
delivery_mode: Some(2), // persistent
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
channel
|
channel
|
||||||
|
|
Loading…
Reference in a new issue