@heq/server-redis

Redis Adapter for heq-server

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
64Jul 4, 2018Jun 2, 2017Minified + gzip package size for @heq/server-redis in KB

Readme

Redis Adapter for heq-server

heq-server is a light-weight persistent and stateless message queue over http protocol. When starting heq-server with @heq/server-redis adapter, redis will be used as the persistence datastore

Usage

const adatper = require('@heq/server-redis')

// example
const queue = adatper({
  ns: 'some-namespace',
  url: 'redis://localhost:6379/1'
})

// commit
const committedEvent = await queue.commit({ type: 'some event', payload: { some: 'value' } });

// query
const events = await queue.query({ from: 5, to: 10 }); // omitting `to` to query up to the latest event

// subscription
const { events$ } = queue.subscribe();

const subscription = events$.observe(event => { /* ... */ });

// unsubscribe
subscription.unsubscribe()

Configuration

This adapter requires 2 options

option name data type description
url string | object must be an valid option that redis.createClient receives
ns string a namespace to allowing multiple queues can be run in one instance of redis

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.