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 |