JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q23933F
  • License MIT

AMQP-based event bus

Package Exports

  • evque

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (evque) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

evque

AMQP-based event bus.

Build Status Coverage Status

Installation

npm i evque --save

Description

Each event = exchange of fanout type, named after event.

Each subscriber = queue bound to exchange, named after event and subscriber.

Diagram

Motivation

  • simple project bootstrap
  • events are preserved across broker restarts
  • events will wait for their listeners (will not disappear if listener is offline)

Example

var bus = require('evque')('amqp://localhost');

bus.on('error', function (ev) {
    console.log(
        'listener %s failed to handle event %s (%j) due to %s',
        ev.listener, ev['event'], ev.data, ev.error.stack
    );
});

bus.on('connection-error', function () {
    console.log('connection closed by RabbitMQ. Restart your app?');
});

bus.subscribe('event1', 'listener1', function (data) {
    console.log('listener1 received event1 (%j)', data);
});

bus.subscribe('event1', 'listener2', function (data) {
    console.log('listener2 received event1 (%j)', data);
});

bus.publish('event1', { a: 'b' });

License

MIT