block-messenger
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -19,9 +19,11 @@ // Create an instance of our factory that makes cars | ||
const MQTT = 'mqtt'; | ||
class MessengerFactory { | ||
} | ||
MessengerFactory.prototype.createMessenger = (options) => { | ||
MessengerFactory.prototype.createMessenger = (type, options) => { | ||
switch (options.type) { | ||
case "mqtt": | ||
switch (type) { | ||
case MQTT: | ||
this.messengerClass = require('./src/mqtt-messenger'); | ||
@@ -39,1 +41,2 @@ break; | ||
exports.BlockMessenger = MessengerFactory; | ||
exports.MQTT = MQTT; |
{ | ||
"name": "block-messenger", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Message exchange between pipeline blocks", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,3 +11,3 @@ # block-messenger | ||
```options = {type = 'mqtt', ...}``` | ||
```type = 'mqtt'``` | ||
@@ -21,6 +21,7 @@ To receive messages, listen to event 'message' (topic, message) | ||
const BlockMessenger = require('block-messenger').BlockMessenger; | ||
const MQTT = require('block-messenger').MQTT; | ||
const bm = new BlockMessenger(); | ||
const options = { | ||
type: "mqtt", | ||
host: '127.0.0.1', | ||
@@ -36,3 +37,3 @@ port: 1883, | ||
const mqtt = bm.createMessenger(options); | ||
const mqtt = bm.createMessenger(MQTT, options); | ||
@@ -82,3 +83,3 @@ mqtt.on('subscribed', (granted) => { | ||
- Implement kafka-messenger.js (options.type = 'kafka') | ||
- Implement kafka-messenger.js (type = 'kafka') | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18637
158
82