msqe-client
v1.0.4
Published
High-performance Node.js client library for the MSQE Message Queue Engine.
Maintainers
Readme
msqe-client
High-performance distributed messaging client built for modern Node.js systems.
🌐 Official Resources
| Resource | Link | |---|---| | Official Website | https://msqe.org | | Enterprise Broker | https://github.com/Sayyed-Mohammad-Adil/msqe-enterprise | | NPM Package | https://www.npmjs.com/package/msqe-client |
⚡ What is MSQE?
MSQE (Message Queue Events) is a distributed messaging and event-streaming platform built entirely with pure Node.js and native WebSockets.
It is designed for modern event-driven systems that require lightweight infrastructure, realtime communication, distributed clustering, and simple deployment workflows.
MSQE provides:
- Realtime event streaming
- Distributed clustering
- Automatic failover support
- Consumer groups
- Replayable events
- Dead letter queues (DLQ)
- Wildcard topic routing
- WebSocket-native communication
- Realtime monitoring support
Built specifically for modern Node.js-native distributed architectures.
🚀 Features
⚡ Lightweight Runtime
- Pure Node.js implementation
- Native WebSocket transport
- Minimal dependencies
- Low memory footprint
- Fast startup time
- Simple deployment architecture
🔥 Realtime Distributed Messaging
Built for:
- Microservices
- Event-driven systems
- Distributed workers
- Analytics pipelines
- Automation platforms
- IoT messaging systems
- Streaming workloads
🧠 Intelligent Failover
Pass multiple broker URLs and the client automatically:
- Detects available brokers
- Reconnects during outages
- Performs automatic failover
- Restores subscriptions
- Resumes consumer groups
🛡 Reliability Features
- Automatic reconnection
- Exponential retry backoff
- Offline buffering
- QoS acknowledgements
- Replay requests
- Dead letter queue support
- Partition-aware delivery
📦 TypeScript First
- Full TypeScript support
- Typed APIs
- Async/await friendly
- ESM-ready support
📋 Requirements
- Node.js >= 18
📦 Installation
# npm
npm install msqe-client
# yarn
yarn add msqe-client
# pnpm
pnpm add msqe-client⚡ Quick Start
Producer Example
import { Producer } from "msqe-client";
const producer = new Producer({
urls: [
"ws://127.0.0.1:9090",
"ws://127.0.0.1:9091",
"ws://127.0.0.1:9092"
],
autoReconnect: true,
reconnectDelay: 1000
});
producer.on("ready", async () => {
try {
const response = await producer.send(
"user.signup",
{
userId: "user_123",
email: "[email protected]"
},
{
qos: 1
}
);
console.log("Published:", response);
} catch (error) {
console.error("Publish failed:", error);
}
});
producer.on("error", (error) => {
console.error("Producer error:", error);
});Subscriber Example
import {
Subscriber,
MessageEnvelope
} from "msqe-client";
const subscriber = new Subscriber({
urls: [
"ws://127.0.0.1:9090",
"ws://127.0.0.1:9091",
"ws://127.0.0.1:9092"
],
topics: [
"user.signup",
"payments.*"
],
groupId: "analytics-service",
autoReconnect: true
});
subscriber.run({
eachMessage: async (
payload: any,
envelope: MessageEnvelope
) => {
console.log("Topic:", envelope.topic);
console.log("Payload:", payload);
}
});
subscriber.on("error", (error) => {
console.error("Subscriber error:", error);
});🧩 Architecture
MSQE uses WebSocket-based broker communication with distributed node coordination, consumer-group balancing, and partition-aware routing.
┌────────────┐ ┌─────────────────┐ ┌────────────┐
│ Producer A │─────▶│ MSQE Broker │◀─────│ Producer B │
└────────────┘ └────────┬────────┘ └────────────┘
│
┌───────────┴───────────┐
┌────────▼────────┐ ┌────────▼────────┐
│ Subscriber A │ │ Subscriber B │
└─────────────────┘ └─────────────────┘🌍 Cluster Support
const producer = new Producer({
urls: [
"ws://node-1:9090",
"ws://node-2:9090",
"ws://node-3:9090"
]
});Supports:
- Multi-node clustering
- Automatic failover
- Distributed partitions
- Consumer balancing
- Replication workflows
- Stateful recovery
📚 API Reference
Producer
new Producer({
url?,
urls?,
autoReconnect?,
reconnectDelay?
});
await producer.send(topic, payload, options);
producer.publish(topic, payload);
producer.disconnect();Methods
| Method | Description |
|---|---|
| send() | Acknowledged publish |
| publish() | Fire-and-forget publish |
| disconnect() | Graceful shutdown |
Subscriber
new Subscriber({
topics,
groupId?,
qos?,
autoReconnect?
});
subscriber.run({
eachMessage: async (payload, envelope) => {}
});
subscriber.requestReplay();
subscriber.disconnect();Methods
| Method | Description |
|---|---|
| run() | Start consuming messages |
| requestReplay() | Request historical events |
| disconnect() | Graceful shutdown |
📊 Design Philosophy Comparison
| Capability | MSQE | RabbitMQ | Kafka | MQTT | |---|---|---|---|---| | Pure Node.js Runtime | ✅ | ❌ | ❌ | ❌ | | Native WebSocket Communication | ✅ | ❌ | ❌ | ⚠️ | | Lightweight Deployment | ✅ | ⚠️ | ❌ | ✅ | | Distributed Clustering | ✅ | ✅ | ✅ | ⚠️ | | Replayable Events | ✅ | ⚠️ | ✅ | ❌ | | Consumer Groups | ✅ | ✅ | ✅ | ❌ | | Simple Developer Experience | ✅ | ⚠️ | ❌ | ✅ |
🐳 Docker & Deployment
docker compose upSupports:
- Docker
- Docker Swarm
- Kubernetes
- Multi-node orchestration
🔐 Security
MSQE supports:
- Token-based authentication
- Topic access control
- Secure WebSocket (WSS)
- Cluster-level permissions
🏃 Running the Broker
The client connects to the MSQE broker cluster.
Broker setup instructions:
https://github.com/Sayyed-Mohammad-Adil/msqe-enterprise
🛣 Roadmap
- Kubernetes Operator
- Persistent distributed storage
- Multi-region replication
- Stream processing engine
- Admin CLI
- GraphQL subscriptions
- WebAssembly filters
- Edge federation
🤝 Contributing
Contributions, issues, and pull requests are welcome.
📄 License
MIT License
👨💻 Author
Built by Sayyed Mohammad Adil
- Website: https://msqe.org
- GitHub: https://github.com/Sayyed-Mohammad-Adil/msqe-enterprise
