Registry / messaging / eip-redis

eip-redis

JSON →
library1.7.1jsnpmunverified

Redis adapter for the eip (Enterprise Integration Patterns) module, providing a PubSub and Queue implementation on top of Redis for distributed event aggregation and resource throttling across multiple nodes. Current stable version is 1.7.1. The package is mature with a stable API, designed specifically for use with the eip framework version ^1.8.0 and redis client ^2.0.0. It enables cross-node pub/sub patterns needed for rate limiting and circuit breaking in distributed Node.js applications. Differentiators include tight integration with eip patterns and explicit Redis connection management. Release cadence is low; last update was years ago.

npm install eip-redis
INSTALL
IMPORT
SIG · EIP-REDIS
E
eip-redis
messagingjavascriptv1.7.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PubSub
✓ const { PubSub } = require('eip-redis');
✗ import { PubSub } from 'eip-redis';
This package does not ship ESM; only CommonJS is supported. Named import via destructuring from require.
Queue
✓ const { Queue } = require('eip-redis');
✗ const Queue = require('eip-redis').Queue;
Also valid, but destructuring is standard. Accessing via default export is incorrect as there is no default export.
default
✓ const eipRedis = require('eip-redis'); const { PubSub } = eipRedis;
✗ import eipRedis from 'eip-redis';
No default export; must use named imports or require the whole module.

Shows how to initialize PubSub and Queue from eip-redis with Redis clients and use them with eip throttle.

const eip = require('eip'); const redis = require('redis'); const { PubSub, Queue } = require('eip-redis'); const { Timer } = require('eip-timer'); const redisPub = redis.createClient(); const redisSub = redis.createClient({ return_buffers: true }); const pubSub = new PubSub(1, 1000, redisPub, redisSub, 'namespace'); const queue = new Queue(redisPub, 'namespace'); const resource = x => x; const throttler = new eip.Route().throttleResource({ pubSub, queue, resource, timer });
Debug
Known issues
breakingRequires Node.js version >= 6.0.0; earlier versions are not supported.
fix
Upgrade Node.js to version 6.0.0 or later, or use an older version of the package if available.
affects: <1.0.0
deprecatedThe redis client option `return_buffers` is deprecated in redis v3+. Use `return_buffer` (singular) instead.
fix
Use `return_buffer: true` when creating the subscriber client.
affects: >=1.7.0
gotchaPubSub constructor expects (eventsPerPeriod, periodInMS, redisPub, redisSub, namespace) but namespace is optional; omitting it can cause collisions across different applications.
fix
Always provide a unique namespace string to avoid event collisions.
affects: >=1.0.0
breakingThe `Timer` import from `eip-timer` is required for throttle; not providing it causes a runtime error.
fix
Install and require `eip-timer` and pass it as `timer` option.
affects: >=1.0.0
deprecatedThe old `require('eip-redis').RedisPubSub` is deprecated in favor of `PubSub`.
fix
Use `PubSub` instead of `RedisPubSub`.
affects: <1.0.0
Errors
Common errors & fixes
TypeError: eip.Route is not a constructor
Using an incompatible version of eip peer dependency (e.g., eip v2+ changed API).
fix
Ensure eip version ^1.8.0 is installed: `npm install eip@^1.8.0`
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server not running or unavailable.
fix
Start Redis server: `redis-server` or specify correct host/port in `redis.createClient()` options.
TypeError: Cannot read property 'subscribe' of undefined
Subscriber Redis client not created with `return_buffers: true`.
fix
Create redisSub with `redis.createClient({ return_buffers: true })`
TypeError: PubSub is not a constructor
Incorrect import; possibly trying to import as default or using wrong module.
fix
Use `const { PubSub } = require('eip-redis');`
Upgrade
Version history
1.7.1latest on npm
Audit
Dependencies
eiprequiredpeer dependency required for core eip route and throttle functionality
redisrequiredpeer dependency required for Redis client connections
Agent activity
30 hits · last 30 days
node
28
OpenAI (training)
1
Resources
eip-redis — npm install eip-redis · libregistry