This module is mainly the implementation of the Apache RocketMQ Broker, containing all the functionalities of the Java version Broker.
- rust toolchain MSRV is 1.75.(stable,nightly)
Run the following command to see usageοΌ
cargo run --bin rocketmq-broker-rust -- --helpOutput:
Apache RocketMQ Broker Server implemented in Rust
For more information: https://github.com/mxsm/rocketmq-rust
Usage: rocketmq-broker-rust [OPTIONS]
Options:
-c, --configFile <FILE>
Broker config properties file path
If not specified, will try to load from:
1. $ROCKETMQ_HOME/conf/broker.toml (if ROCKETMQ_HOME is set)
2. Default configuration values
-p, --printConfigItem
Print all configuration items and exit
Prints all broker configuration properties including:
- Broker configuration
- Netty server configuration
- Netty client configuration
- Message store configuration
- Authentication configuration
-m, --printImportantConfig
Print important configuration items and exit
Prints only the important configuration items that are most
commonly used for broker setup and troubleshooting.
-n, --namesrvAddr <ADDR>
Name server address list
Format: '192.168.0.1:9876' or '192.168.0.1:9876;192.168.0.2:9876'
Multiple addresses should be separated by semicolon (;)
Can also be set via NAMESRV_ADDR environment variable
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
Run the following command to start the broker:
cargo run --bin rocketmq-broker-rust# Set ROCKETMQ_HOME environment variable first
# Windows
set ROCKETMQ_HOME=D:\rocketmq
# Linux/macOS
export ROCKETMQ_HOME=/opt/rocketmq
# Then start broker
cargo run --bin rocketmq-broker-rustcargo run --bin rocketmq-broker-rust -- -c ./conf/broker.toml# Single name server
cargo run --bin rocketmq-broker-rust -- -n 192.168.1.100:9876
# Multiple name servers
cargo run --bin rocketmq-broker-rust -- -n "192.168.1.100:9876;192.168.1.101:9876"cargo run --bin rocketmq-broker-rust -- -pcargo run --bin rocketmq-broker-rust -- -m# Set name server via environment variable
# Windows
set NAMESRV_ADDR=192.168.1.100:9876
# Linux/macOS
export NAMESRV_ADDR=192.168.1.100:9876
# Then start broker (will use the environment variable)
cargo run --bin rocketmq-broker-rustThe broker uses the following configuration priority (highest to lowest):
- Command-line arguments (
-c,-n) - Environment variables (
NAMESRV_ADDR) - Configuration file (
broker.toml) - Default values
ROCKETMQ_HOME: RocketMQ installation directory (required)NAMESRV_ADDR: Name server address (optional), format:127.0.0.1:9876or192.168.0.1:9876;192.168.0.2:9876
If no configuration file is specified via -c, the broker will try to load from:
$ROCKETMQ_HOME/conf/broker.toml
Example broker.toml:
[broker_identity]
broker_name = "broker-a"
broker_cluster_name = "DefaultCluster"
broker_id = 0
namesrv_addr = "127.0.0.1:9876"
broker_ip1 = "127.0.0.1"
listen_port = 10911
store_path_root_dir = "./store"
enable_controller_mode = false- 0: Normal exit (when using
-por-mflags) - -1: Invalid command-line arguments
- -2:
ROCKETMQ_HOMEenvironment variable not set - -3: Failed to parse configuration file
- -4: Invalid broker configuration
Feature list:
- Not support: π β
- Base support: β€οΈ β
- Perfect support: π β
| Feature | request code | Support | remark |
|---|---|---|---|
| topic config load | β | π β | TopicConfigManager class function |
| topic queue mapping load | β | π β | TopicQueueMappingManager class function |
| consume offset load | β | π β | ConsumerOffsetManager class function |
| subscription group load | β | π β | SubscriptionGroupManager class function |
| consumer filter load | β | π β | ConsumerFilterManager class function |
| consumer order info load | β | π β | ConsumerOrderInfoManager class function |
| message store load | β | π β | |
| timer message store load | β | π β | |
| schedule message store load | β | π β | |
| send message hook | β | π β | |
| consume message hook | β | π β | |
| send message | 10 | β€οΈ β | |
| send message v2 | 310 | β€οΈ β | |
| send batch message | 320 | β€οΈ β | |
| consume send message back | 36 | β€οΈ β | |
| pull message | 11 | β€οΈ β | |
| lite pull message | 361 | β€οΈ β | |
| peek message | 200052 | π β | |
| pop message | 200050 | β€οΈ β | |
| ack message | 200051 | β€οΈ β | |
| batch ack message | 200151 | β€οΈ β | |
| change message invisibletime | 200053 | β€οΈ β | |
| notification | 200054 | π β | |
| polling info | 200055 | π β | |
| send reply message | 324 | β€οΈ β | |
| send reply message v2 | 325 | β€οΈ β | |
| query message | 12 | β€οΈ β | |
| view message by id | 33 | β€οΈ β | |
| heart beat | 34 | β€οΈ β | |
| unregister client | 35 | β€οΈ β | |
| check client config | 46 | π β | |
| get consumer list by group | 38 | β€οΈ β | |
| update consumer offset | 15 | β€οΈ β | |
| query consumer offset | 14 | β€οΈ β | |
| query assignment | 400 | β€οΈ β | |
| set message request mode | 401 | β€οΈ β | |
| end transacation | 37 | β€οΈ β | |
| default processor | β | π β | AdminBrokerProcessor class function |