RocketMQ Admin CLI
rocketmq-admin-cli is the command-line adapter for RocketMQ admin operations. It owns CLI parsing, command grouping, shell completion, confirmation prompts, progress display, and terminal rendering. Shared admin behavior is delegated to rocketmq-admin-core.
Role in the Admin Stack
shell command
-> clap args in rocketmq-admin-cli
-> rocketmq-admin-core request DTO
-> rocketmq-admin-core service
-> structured result
-> CLI renderer
Future TUI or GUI adapters should depend on rocketmq-admin-core, not on this crate.
Responsibilities
- Define CLI commands and subcommands with
clap. - Preserve Apache RocketMQ tool-compatible command names and flags where supported.
- Convert CLI args into
rocketmq-admin-corerequest DTOs. - Call core services and render structured results for terminal users.
- Own shell completion generation.
- Own confirmation prompts, progress bars, table/JSON/YAML output, and command-line error messages.
Non-Responsibilities
- RocketMQ admin RPC orchestration that can be shared by other frontends.
- Domain request/result types shared with TUI or tests.
- Ratatui UI state or view models.
- Direct implementation of new admin business logic when a core service should exist.
Build and Run
From the repository root:
Build a release binary:
The release binary is written to:
target/release/rocketmq-admin-cli
Common Commands
# Show top-level help
# Show categorized command table
# Generate shell completion
# Topic commands
# NameServer commands
# Broker config commands
# Container and export commands
Command Domains
| Domain | Purpose |
|---|---|
topic |
Topic create/update/delete/query and static topic operations. |
nameserver |
NameServer config, KV config, and write permission operations. |
broker |
Broker config, status, cleanup, cold-data, timer, and commit-log operations. |
cluster |
Cluster listing and cluster send-RT diagnostics. |
container |
Broker container add/remove operations. |
consumer |
Subscription group, consumer progress, running info, and consume mode operations. |
connection |
Consumer and producer connection inspection. |
offset |
Clone, reset, skip, and query consumer offsets. |
queue |
ConsumeQueue query and RocksDB CQ write-progress checks. |
message |
Message query, decode, print, consume, and send diagnostics. |
producer |
Producer info and send diagnostic operations. |
controller |
Controller config, metadata, and master election operations. |
auth |
User and ACL management. |
ha |
HA status and sync-state-set inspection. |
stats |
Cluster-wide topic and consumer statistics. |
export |
Config, metadata, metrics, pop-record, and RocksDB metadata export. |
lite |
Lite topic/group/client inspection and dispatch operations. |
Environment
Most commands accept -n or --namesrvAddr. You can also set the NameServer address through the standard RocketMQ environment variable when supported by the command path:
On Unix shells:
Adding or Migrating a Command
Use this flow for new commands and for continuing old command migration:
- Add or reuse a request/result DTO in
rocketmq-admin-core/src/core/<domain>.rs. - Add or reuse a service method in
rocketmq-admin-core. - Add CLI args and rendering in
rocketmq-admin-cli/src/commands/<domain>/. - Convert CLI args into the core request DTO.
- Call the core service and render the structured result.
- Add core request/service tests and CLI parse/help/smoke tests.
Do not put shared admin RPC orchestration directly in CLI command files if the operation can be reused by TUI or future adapters.
Validation
Run targeted CLI tests after changing this crate:
For root workspace Rust changes, also run:
Related Crates
rocketmq-admin-core: reusable admin capability layer.rocketmq-admin-tui: terminal UI adapter built on core services.