📨 msgQ is a lightweight in-memory message streaming service supporting multiple topics, producers, and consumers. It ensures message order within partitions, offers thread safety, and enables real-time data streaming for local environments and testing scenarios.
- ✅ Create new topics with configurable number of partitions
- ✏️ Edit topics
- ❌ Delete topics
- 📤 Publish messages to topics
- 🔁 Partitioning based on key:
int partitionIndex = key.hashCode() % partitionCount;
- 🔔 Subscribe and unsubscribe to specific topics
- 📥 Consume messages from assigned partitions
- 📌 Tracks offset for each consumer per partition to avoid reprocessing
- 🧾 Messages are composed of a
keyand apayload - 🔄 Messages are ordered within the same partition
- Supports multiple producers and consumers concurrently
- Internally synchronized structures for safe concurrent access
+--------------------------+
| Topic: payments |
| (3 partitions) |
+--------------------------+
| | |
▼ ▼ ▼
[P0] [P1] [P2]
| | |
┌─────────────────┘ | └─────────────────┐
▼ ▼ ▼
[Consumer A] [Consumer B] [Consumer C]
(Offset per P0) (Offset per P1) (Offset per P2)
- Partitions allow parallelism.
- Each consumer reads from its offset, maintaining idempotent behavior.
- Producers are not aware of consumers, following decoupled pub-sub architecture.
- Java 17+
- Maven (for building)
git clone https://github.com/starreh-w0w/msgQ.git
cd msgQYou can use Demo class interact with topics, producers, and consumers.
- 🛠️ Local development mock for Kafka-style systems
- 📊 Event-driven architecture simulations
- 📚 Educational purposes for understanding pub-sub, queues, offsets
- Persistent storage (e.g., WAL, disk)
- Message TTL / expiry support
- Dead-letter and retry queues
- Web dashboard for message and topic visualization
- Consumer groups and message rebalancing
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Distributed under the MIT License. See LICENSE for more information.
Made with ❤️ by Tyrant
Inspired by Apache Kafka, designed for simplicity and local use-cases 🚀