ocbesbn-redis-events
![Build status](https://circleci.com/gh/OpusCapita/redis-events.svg?style=shield&circle-token=33dde9a3e5bbe120832064948a3d073ba7a6ab15)
This module provides simplified access to the publish/subscribe system provided by Redis. To have a look at the full API, please visit the related wiki page.
Minimum setup
First got to your local code directory and run:
npm install ocbesbn-redis-events
To go with the minimum setup, you need to have access to a running Consul server to get your endpoint configuration and a Redis server that is registered in consul.
If all this is set up, go to you code and add the following command:
const RedisEvents = require('ocbesbn-redis-events');
var events = new RedisEvents({ consul : { host : '{{your-consul-host}}' } });
events.subscribe('my-channel', console.log).then(() => events.emit('Hello, world!', 'my-channel'));
events.subscribe('my-channel.*', console.log).then(() => events.emit('Hello, world!', 'my-channel.sub-channel'));
events.disposeAll();
Default configuration
The default configuration object provides hints about what the module's standard behavior is like.
{
serializer : JSON.stringify,
parser : JSON.parse,
defaultEmitChannel : null,
consul : {
host : 'consul',
redisServiceName : 'redis',
redisPasswordKey : 'redis/password'
},
context : {
}
}