2021-06-14 03:51:26 +02:00
|
|
|
use anyhow::Result;
|
2021-12-03 14:50:23 +01:00
|
|
|
use clap::Parser;
|
2021-06-14 03:51:26 +02:00
|
|
|
use posixmq::PosixMq;
|
|
|
|
|
|
|
|
/// Print information about an existing message queue
|
2021-12-03 14:50:23 +01:00
|
|
|
#[derive(Debug, Parser)]
|
2021-06-14 03:51:26 +02:00
|
|
|
pub struct Info {
|
|
|
|
/// Name of the queue
|
2021-06-20 02:00:08 +02:00
|
|
|
#[clap(value_name = "QUEUE")]
|
2021-07-08 14:13:59 +02:00
|
|
|
queue: String,
|
2021-06-14 03:51:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Info {
|
|
|
|
pub fn run(&self) -> Result<()> {
|
|
|
|
let attrs = PosixMq::open(&self.queue)?.attributes()?;
|
|
|
|
|
|
|
|
println!(
|
|
|
|
"Message queue: {}, msg_max: {}, msgsize_max: {}, current_messages: {}",
|
2021-12-03 14:57:38 +01:00
|
|
|
self.queue, attrs.capacity, attrs.max_msg_len, attrs.current_messages
|
2021-06-14 03:51:26 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|