mod consumer_connection_sub_command;
mod producer_connection_sub_command;
use std::sync::Arc;
use clap::Subcommand;
use rocketmq_error::RocketMQResult;
use rocketmq_remoting::runtime::RPCHook;
use crate::commands::CommandExecute;
use crate::commands::connection::consumer_connection_sub_command::ConsumerConnectionSubCommand;
use crate::commands::connection::producer_connection_sub_command::ProducerConnectionSubCommand;
#[derive(Subcommand)]
pub enum ConnectionCommands {
#[command(
name = "consumerConnection",
about = "Query consumer's socket connection, client version and subscription"
)]
ConsumerConnection(ConsumerConnectionSubCommand),
#[command(name = "producerConnection", about = "Query producer's connection")]
ProducerConnection(ProducerConnectionSubCommand),
}
impl CommandExecute for ConnectionCommands {
async fn execute(&self, rpc_hook: Option<Arc<dyn RPCHook>>) -> RocketMQResult<()> {
match self {
ConnectionCommands::ConsumerConnection(cmd) => cmd.execute(rpc_hook).await,
ConnectionCommands::ProducerConnection(cmd) => cmd.execute(rpc_hook).await,
}
}
}