npm

@journalone/service-foundation

0.0.0 • Public • Published

Journal One microservice foundation

Install

Needs at least node v7.6 (async, await support)

npm install @journalone/service-foundation

Usage

Shared listener

One queue is shared between multiple listeners and each get only a subset of messages.

const { sharedListener } = require('@journalone/service-foundation');

let exampleListener = sharedListener('exchange-name', 'shared-queue-name', [ 'topic.*' ]);

exampleListener.subscribe((message) => {

  message.getContent();
  message.acknowledge();

});

exampleListener.connect();

Exclusive listener

Every listener has its own queue and gets all messages.

const { exclusiveListener } = require('@journalone/service-foundation');

let exampleListener = exclusiveListener('exchange-name', [ 'topic.*' ]);

exampleListener.subscribe((message) => {

  message.getContent();
  message.acknowledge();

});

exampleListener.connect();

Dispatch message

Dispatches a new message

const { dispatch } = require('./serviceEndpoint');

let dispatchMessage = dispatch('exchange-name');

dispatchMessage('topic', { /* json encodable object */ });

Readme

Keywords

none

Package Sidebar

Install

npm i @journalone/service-foundation

Weekly Downloads

0

Version

0.0.0

License

UNLICENCED

Last publish

Collaborators

  • schornio