Nocturnal Programmer's Machine

    @heq/server-redis

    2.0.5 • Public • Published

    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

    Install

    npm i @heq/server-redis

    DownloadsWeekly Downloads

    0

    Version

    2.0.5

    License

    MIT

    Unpacked Size

    139 kB

    Total Files

    9

    Last publish

    Collaborators

    • tungv