@growsari/event-gateway-client

1.0.3 • Public • Published

Event Gateway Client

Client library for interacting with Growsari Event Gateway

Installation

Install the package using the below command:

$ npm i @growsari/event-gateway-client --save

Usage

Create EventGatway Client

Create a client by passing in clientId (for now till the service implements authentication)

let client = new EventGatewayClient('ms-loc');

Subsribe to a topic

It accepts topic name and notification url (to get the notifications)

client.subscribeToTopic(topicName, notificationUrl);

Publish message to a topic

It accepts topic name and list of messages. Each message contains event name and the payload.

client.publishMessage(topicName, [ message,..}]);

Examples:

let client = new EventGatewayClient('ms-loc');

// Subscribe to a Topic - orders
client.subscribeToTopic('orders', 'http://127.0.0.1/ms-loc/test-event-push');

// Publish Event Message to a Topic - orders
client.publishMessage('orders', [{ event: 'ORDER_CREATED', payload: { "order_id": 10, "price": 10.0 } }]);

Package Sidebar

Install

npm i @growsari/event-gateway-client

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

3.21 kB

Total Files

4

Last publish

Collaborators

  • madhugogineni
  • ddimaano.gs
  • prasad.riktam
  • melyo
  • leland.growsari
  • gs.dwight.badua