This library provides a client for the RabbitMQ stream protocol, enabling JavaScript and TypeScript applications to interact with RabbitMQ Streams. Designed for high-throughput, low-latency messaging, it facilitates publishing and consuming messages with advanced features like super streams, deduplication, and single active consumers. The current stable version is 1.0.0, released in April 2024. The project exhibits an active release cadence with frequent updates and bug fixes, indicated by multiple minor and patch releases leading up to 1.0.0, addressing features like external authentication, SSL options, and enhanced connection management. Key differentiators include its native support for RabbitMQ's stream protocol, enabling advanced features for horizontal scaling, message deduplication for exactly-once semantics, and single active consumer patterns for workload distribution. It also provides robust connection handling, including explicit connection pooling and automatic reconnect mechanisms, making it suitable for high-reliability, distributed systems.
npm install rabbitmq-stream-js-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates connecting to RabbitMQ Stream, declaring a stream, publishing a message, and consuming it.
Review connection management strategies. The client now handles auto-reconnecting internally. Refer to updated README examples for managing connection stability, e.g., how to handle auto-reconnects as shown in the v0.4.0 changelog.
Implement a robust strategy for generating unique and monotonic `publishingId`s, potentially using a shared sequence generator or UUIDs with external storage for persistence across application restarts.
Always provide the `ca` (Certificate Authority) certificate when connecting through TLS/SSL in production environments to ensure proper certificate chain validation and secure communication.
Rely on the client's public API for connection management. Avoid direct manipulation of internal connection objects, as the library now explicitly manages connection lifecycles within its pool.
Ensure all messages intended for RabbitMQ Streams are published using `rabbitmq-stream-js-client`. Do not mix publishing messages to streams using `amqplib` or other AMQP 0-9-1 clients, as the stream protocol has its own specific message structure.
Verify that your RabbitMQ server is running and the Stream plugin is enabled. Check the `hostname` and `port` (default 5552 for streams) in your connection configuration. Ensure no firewall rules are preventing the connection.
Use ESM named imports: `import { connect } from 'rabbitmq-stream-js-client';`. If you must use `require`, destructure it: `const { connect } = require('rabbitmq-stream-js-client');`.No dependency data recorded yet.