RocketMQ-Rust
π A high-performance, reliable, and feature-rich unofficial Rust implementation of Apache RocketMQ, designed to bring enterprise-grade message middleware to the Rust ecosystem.
β¨ Overview
RocketMQ-Rust is a complete reimplementation of Apache RocketMQ in Rust, leveraging Rust's unique advantages in memory safety, zero-cost abstractions, and fearless concurrency. This project aims to provide Rust developers with a production-ready distributed message queue system that delivers exceptional performance while maintaining full compatibility with the RocketMQ protocol.
π― Why RocketMQ-Rust?
- π¦ Memory Safety: Built on Rust's ownership model, eliminating entire classes of bugs like null pointer dereferences, buffer overflows, and data races at compile time
- β‘ High Performance: Zero-cost abstractions and efficient async runtime deliver exceptional throughput with minimal resource overhead
- π Thread Safety: Fearless concurrency enables safe parallel processing without the risk of race conditions
- π Cross-Platform: First-class support for Linux, Windows, and macOS with native performance on each platform
- π Ecosystem Integration: Seamlessly integrates with the rich Rust ecosystem including Tokio, Serde, and other modern libraries
- π¦ Production Ready: Battle-tested architecture with comprehensive error handling and observability
ποΈ Architecture
RocketMQ-Rust implements a distributed architecture with the following core components:
- Name Server: Lightweight service discovery and routing coordination
- Broker: Message storage and delivery engine with support for topics, queues, and consumer groups
- Producer Client: High-performance message publishing with various sending modes
- Consumer Client: Flexible message consumption with push and pull models
- Store: Efficient local storage engine optimized for sequential writes
- Controller (In Development): Advanced high availability and failover capabilities
π Documentation
- π Official Documentation: rocketmqrust.com - Comprehensive guides, API references, and best practices
- π€ AI-Powered Docs: DeepWiki - Interactive documentation with intelligent search
- π API Docs: docs.rs/rocketmq-rust - Complete API documentation
- π Examples: rocketmq-client/examples - Ready-to-run code samples
π Quick Start
Prerequisites
- Rust toolchain 1.85.0 or later (stable or nightly)
- Basic familiarity with message queue concepts
Installation
Add the client SDK to your Cargo.toml:
[]
= "0.8.0"
Or for specific components:
[]
# Client SDK (Producer & Consumer)
= "0.8.0"
# Core utilities and data structures
= "0.8.0"
# Low-level runtime abstractions
= "0.8.0"
Start Name Server
# Start with default configuration (listening on 0.0.0.0:9876)
# Or specify custom host and port
# View all options
Start Broker
# Set ROCKETMQ_HOME environment variable (required)
# Linux/macOS
# Start broker with default configuration
# Start with custom name server address
# Start with custom configuration file
# View all options
Send Your First Message
use DefaultMQProducer;
use MQProducer;
use Result;
use Message;
async
For more examples including batch sending, transactions, and consumer patterns, check out:
π¦ Components & Crates
RocketMQ-Rust is organized as a monorepo with the following crates:
| Crate | Description | Status |
|---|---|---|
| rocketmq | Core library and main entry point | β Production |
| rocketmq-namesrv | Name server for service discovery | β Production |
| rocketmq-broker | Message broker and storage engine | β Production |
| rocketmq-client | Producer and consumer SDK | β Production |
| rocketmq-store | Local storage implementation | β Production |
| rocketmq-remoting | Network communication layer | β Production |
| rocketmq-common | Common utilities and data structures | β Production |
| rocketmq-runtime | Async runtime abstractions | β Production |
| rocketmq-filter | Message filtering engine | β Production |
| rocketmq-auth | Authentication and authorization | β Production |
| rocketmq-error | Error types and handling | β Production |
| rocketmq-macros | Procedural macros and derive macros | β Production |
| rocketmq-controller | High availability controller | π§ In Development |
| rocketmq-proxy | Protocol proxy layer | π§ In Development |
| rocketmq-example | Example applications and demos | β Production |
| rocketmq-tools | Command-line tools and utilities | π§ In Development |
| ββ rocketmq-admin | Admin tools for cluster management | π§ In Development |
| β ββ rocketmq-admin-core | Core admin functionality | π§ In Development |
| β ββ rocketmq-admin-tui | Terminal UI for admin operations | π§ In Development |
| ββ rocketmq-store-inspect | Storage inspection tools | β Production |
| rocketmq-dashboard | Management dashboard and UI | π§ In Development |
| ββ rocketmq-dashboard-common | Shared dashboard components | π§ In Development |
| ββ rocketmq-dashboard-gpui | GPUI-based desktop dashboard | π§ In Development |
| ββ rocketmq-dashboard-tauri | Tauri-based cross-platform dashboard | π§ In Development |
πΊοΈ Roadmap
Our development follows the RocketMQ architecture with focus on:
- Core Messaging: Topic management, message storage, and basic publish/subscribe
- Client SDK: Producer and consumer APIs with async support
- Name Server: Service discovery and routing
- Broker: Message persistence and delivery guarantees
- Message Filtering: Tag-based and SQL92 filtering
- Transactions: Distributed transaction message support
- Controller Mode: Enhanced high availability with Raft consensus
- Tiered Storage: Cloud-native tiered storage implementation
- Proxy: Multi-protocol gateway support
- Observability: Metrics, tracing, and monitoring integration
For detailed progress and planned features, see our roadmap diagram.
π‘ Features & Highlights
Performance
- High Throughput: Optimized for millions of messages per second
- Low Latency: Sub-millisecond message publishing with async I/O
- Memory Efficient: Smart memory management with zero-copy where possible
- Concurrent Processing: Fully leverages multi-core processors
Reliability
- Data Durability: Configurable message persistence with fsync control
- Message Ordering: FIFO ordering guarantees within message queues
- Failure Recovery: Automatic failover and recovery mechanisms
- Idempotency: Built-in deduplication support
Developer Experience
- Intuitive API: Ergonomic Rust APIs with builder patterns
- Type Safety: Strong typing prevents runtime errors
- Rich Examples: Comprehensive examples for common use cases
- Active Development: Regular updates and community support
π§ͺ Development
Building from Source
# Clone the repository
# Build all components
# Run tests
# Run specific component
Running Tests
# Run all tests
# Run tests for specific crate
# Run with logging
RUST_LOG=debug
Code Quality
# Format code
# Run clippy
# Check documentation
π€ Contributing
We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or sharing ideas, your input is valuable.
How to Contribute
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Contribution Guidelines
- Follow Rust best practices and idiomatic patterns
- Add tests for new functionality
- Update documentation as needed
- Ensure CI passes before submitting PR
- Use meaningful commit messages
For detailed guidelines, please read our Contribution Guide.
Development Resources
β FAQ
Yes, core components (NameServer, Broker, Client SDK) are production-ready and actively maintained. Controller and Proxy modules are still in development.
Yes, RocketMQ-Rust implements the RocketMQ protocol and can interoperate with Apache RocketMQ Java clients and servers.
The minimum supported Rust version is 1.85.0 (stable or nightly).
RocketMQ-Rust leverages Rust's zero-cost abstractions and efficient async runtime to deliver comparable or better performance with lower memory footprint. Benchmarks are available in individual component documentation.
Yes, you can deploy RocketMQ-Rust components alongside Java RocketMQ. For example, you can use Rust clients with Java brokers, or vice versa.
Migration can be done incrementally:
- Start by using Rust client SDK with existing Java brokers
- Gradually replace brokers with Rust implementation
- Both implementations can coexist during migration
Refer to our migration guide for detailed steps.
π₯ Community & Support
- π¬ Discussions: GitHub Discussions - Ask questions and share ideas
- π Issues: GitHub Issues - Report bugs or request features
- π§ Contact: Reach out to mxsm@apache.org
Contributors
Thanks to all our contributors! π
Star History
π License
RocketMQ-Rust is dual-licensed under:
- Apache License 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
You may choose either license for your use.
π Acknowledgments
- Apache RocketMQ Community for the original Java implementation and design
- Rust Community for excellent tooling and libraries
- All Contributors who have helped make this project better