andela-pubsub

    1.5.10 • Public • Published

    Andela Pubsub

    This package houses tech team pubsub implementation.

    Usage

    To emit an event, use

    const pubsub = require('andela-pubsub')
     
    pubsub.emit({ data: payload, attributes: { eventType: 'NameOfEvent', ... }}, topicName)

    To subscribe to an event, use

    const pubsub = require('andela-pubsub')
     
    const handlers = {
      EventName: async HandlerFunction
    }
     
    pubsub.subscribe([ { topicName, subscriptionName }], handlers )
     

    To set custom deadline timeout (time needed to process an event), use

    const pubsub = require('andela-pubsub')
     
    const handlers = {
      EventName: { timeoutInSeconds: xxxx, method: async HandlerFunction }
    }
     
    pubsub.subscribe([ { topicName, subscriptionName }], handlers )
     

    Install

    npm i andela-pubsub

    DownloadsWeekly Downloads

    58

    Version

    1.5.10

    License

    ISC

    Unpacked Size

    26.8 kB

    Total Files

    8

    Last publish

    Collaborators

    • andela