This project is still working-on-progress
ToQueue is a high-performance in-memory message broker written in Rust.
cargo run --bin toq-server
# With logging: RUST_LOG=info cargo run --bin toq-server# Produce message to a topic
cargo run --bin toq-cli -- produce --topic jobs --data "task1"
# Consume from queue (non-blocking)
cargo run --bin toq-cli -- consume --queue jobs
# Consume with timeout (blocking, milliseconds)
cargo run --bin toq-cli -- consume --queue jobs --timeout 5000# Create resources
cargo run --bin toq-cli -- create-topic --topic events
cargo run --bin toq-cli -- create-queue --queue logger
cargo run --bin toq-cli -- create-queue --queue metrics
# Bind queues to topic
cargo run --bin toq-cli -- bind-queue --topic events --queue logger
cargo run --bin toq-cli -- bind-queue --topic events --queue metrics
# Produce once, consumed by both queues
cargo run --bin toq-cli -- produce --topic events --data "user_login"
cargo run --bin toq-cli -- consume --queue logger
cargo run --bin toq-cli -- consume --queue metrics- Auto-create: Topics and queues created automatically on first use
- Blocking Consume: Wait for messages with configurable timeout (milliseconds)
- Fan-out Routing: One topic can broadcast to multiple queues
- Persistence: Write-ahead log (WAL) for messages, JSON for metadata
- Clustering: Rendezvous hashing for distributed leadership
- Graceful Shutdown: SIGINT/SIGTERM handling with state saving
Producer → Topic (routing) → Queue 1 (storage) → Consumer 1
→ Queue 2 (storage) → Consumer 2
- Topic: Routing address (no storage, distributes to bound queues)
- Queue: In-memory buffer with WAL persistence
- Binding: Many-to-many relationship between topics and queues