2.0.5 • Published 4 years ago

@heq/server-redis v2.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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 namedata typedescription
urlstring | objectmust be an valid option that redis.createClient receives
nsstringa namespace to allowing multiple queues can be run in one instance of redis
2.0.5

4 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago