pilgrimage
This is a Rust implementation of a distributed messaging system. It uses a simple design inspired by Apache Kafka. It simply records messages to local files.
Features
- Topic-based pub/sub model
- Scalability through partitioning
- Persistent messages (log file based)
- Leader/Follower Replication
- Fault Detection and Automatic Recovery
- Delivery guaranteed by acknowledgement (ACK)
- Fully implemented leader selection mechanism
- Partition Replication
- Persistent messages
- Schema Registry for managing message schemas and ensuring compatibility
- Automatic Scaling
Usage
Dependency
- Rust 1.51.0 or later
Functionality Implemented
- Message Queue: Efficient message queue implementation using
MutexandVecDeque. - Broker: Core broker functionality including message handling, node management, and leader election.
- Consumer Groups: Support for consumer groups to allow multiple consumers to read from the same topic.
- Leader Election: Mechanism for electing a leader among brokers to manage partitions and replication.
- Storage: Persistent storage of messages using local files.
- Replication: Replication of messages across multiple brokers for fault tolerance.
- Schema Registry: Management of message schemas to ensure compatibility between producers and consumers.
- Benchmarking: Comprehensive benchmarking tests to measure performance of various components.
- Automatic Scaling: Automatically scale the number of instances based on load.
Basic usage
use ;
use ;
Multi-threaded message processing
use Broker;
use Arc;
use thread;
Fault Detection and Automatic Recovery
The system includes mechanisms for fault detection and automatic recovery. Nodes are monitored using heartbeat signals, and if a fault is detected, the system will attempt to recover automatically.
use Broker;
use ;
use thread;
use Duration;
License
MIT
Examples
To execute a basic example, use the following command:
Bench
cargo bench