rabbit_auto/stream_builder/
queue_options.rs1use std::time::Duration;
2use lapin::types::{ FieldTable};
3
4#[derive(Default)]
6pub struct QueueDeclare {
7 ttl: Option<Duration>,
8}
9
10impl Into<FieldTable> for QueueDeclare {
11 fn into(self) -> FieldTable {
12 let mut fields = FieldTable::default();
13 if let Some(ttl) = self.ttl {
14 fields.insert("x-message-ttl".into(), (ttl.as_millis() as u32).into() );
15 }
16 fields
17 }
18}
19
20impl QueueDeclare {
21 pub fn ttl(duration: Duration) -> QueueDeclare {
23 Self { ttl: Some(duration) }
24 }
25}