Redis Adapter for heq-server


642.0.52 years ago4 years agoMinified + gzip package size for @heq/server-redis in KB


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


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


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.