sdc-pubsub maven integration

Added distribution management section to pom.xml

Change-Id: If0a7d87d337730b2eec1de34c6893edd977bd739
Issue-ID: SDC-1540
Signed-off-by: Idan Amit <ia096e@intl.att.com>
1 file changed
tree: 063e738ad657a27ef8a4baaf2934a2002490ac56
  1. lib/
  2. .gitattributes
  3. .gitignore
  4. .gitreview
  5. .npmignore
  6. index.ts
  7. INFO.yaml
  8. LICENSE.TXT
  9. package.json
  10. pom.xml
  11. README.md
  12. tsconfig.json
  13. version.properties
  14. webpack.config.js
README.md

sdc-pubsub

sdc-pubsub npm package.

Installation

Installing using npm:

npm install sdc-pubsub

Loading It Up

CommonJS

import {PluginPubSub} from 'sdc-pubsub'

Global Variable

<!-- index.html -->
<script src="./node_Modules/sdc-pubsub/dist/sdc-pubsub.js"></script>
// script.js
var pubsub = window.sdcPubSub.PluginPubSub;

Usage

Initialize a pubsub client

// eventsClientId = client id to be used by the event bus, received from query params
// parentUrl = event bus location url for communication, received from query params
// eventsToWaitFor = list of events names that the event hub should wait for their completion.
//                   the client should send an "ACTION_COMPLETED" event to the hub in order to notify the event hub to continue with the flow.
//                   For example: [ “CHECK_IN” ]

var client = new PluginPubSub('eventsClientId, parentUrl, eventsToWaitFor')

Notify about events

client.notify(“READY”)

Register for an event

// When lisetning to event we have to specify the specific event we want to act once it being received.
// eventData.type will hold the event name that was notified by someone else
client.on((eventData,event) => {
      if(eventData.type == WINDOW_OUT”) {
		             //do logic
       }
   }
)

Dependencies

None.

Tests

None.

Authors

Links

License

Copyright 2018 AT&T, Inc.

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0