resolve-bus-zmq
Advanced tools
Comparing version 0.11.0 to 0.12.1
@@ -1,25 +0,18 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _stringify = require('babel-runtime/core-js/json/stringify'); | ||
var _stringify = _interopRequireDefault(require("@babel/runtime/core-js/json/stringify")); | ||
var _stringify2 = _interopRequireDefault(_stringify); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
var _promise = _interopRequireDefault(require("@babel/runtime/core-js/promise")); | ||
var _extends3 = _interopRequireDefault(_extends2); | ||
var _zeromq = _interopRequireDefault(require("zeromq")); | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
var _promise2 = _interopRequireDefault(_promise); | ||
var _zeromq = require('zeromq'); | ||
var _zeromq2 = _interopRequireDefault(_zeromq); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var defaultOptions = { | ||
@@ -37,14 +30,14 @@ channel: 'DEFAULT', | ||
var subSock = _zeromq2.default.socket('xsub'); | ||
subSock.identity = 'subscriber' + process.pid; | ||
subSock.bindSync('tcp://' + address + ':' + subPort); | ||
var subSock = _zeromq.default.socket('xsub'); | ||
var pubSock = _zeromq2.default.socket('xpub'); | ||
pubSock.identity = 'publisher' + process.pid; | ||
subSock.identity = "subscriber".concat(process.pid); | ||
subSock.bindSync("tcp://".concat(address, ":").concat(subPort)); | ||
// ZMQ parameters described here http://api.zeromq.org/3-3:zmq-setsockopt | ||
pubSock.setsockopt(_zeromq2.default.ZMQ_SNDHWM, 1000); | ||
pubSock.setsockopt(_zeromq2.default.ZMQ_XPUB_VERBOSE, 0); | ||
pubSock.bindSync('tcp://' + address + ':' + pubPort); | ||
var pubSock = _zeromq.default.socket('xpub'); | ||
pubSock.identity = "publisher".concat(process.pid); // ZMQ parameters described here http://api.zeromq.org/3-3:zmq-setsockopt | ||
pubSock.setsockopt(_zeromq.default.ZMQ_SNDHWM, 1000); | ||
pubSock.setsockopt(_zeromq.default.ZMQ_XPUB_VERBOSE, 0); | ||
pubSock.bindSync("tcp://".concat(address, ":").concat(pubPort)); | ||
subSock.on('message', function (data) { | ||
@@ -63,6 +56,7 @@ return pubSock.send(data); | ||
var sock = _zeromq2.default.socket('pub'); | ||
sock.connect('tcp://' + address + ':' + subPort); | ||
var sock = _zeromq.default.socket('pub'); | ||
sock.connect("tcp://".concat(address, ":").concat(subPort)); | ||
return function (event) { | ||
var message = channel + ' ' + event; | ||
var message = "".concat(channel, " ").concat(event); | ||
sock.send(message); | ||
@@ -77,5 +71,6 @@ }; | ||
var sock = _zeromq2.default.socket('sub'); | ||
var sock = _zeromq.default.socket('sub'); | ||
sock.subscribe(channel); | ||
sock.connect('tcp://' + address + ':' + pubPort); | ||
sock.connect("tcp://".concat(address, ":").concat(pubPort)); | ||
sock.on('message', function (message) { | ||
@@ -88,3 +83,3 @@ var data = message.toString().substring(channel.length + 1); | ||
function init(options, trigger) { | ||
return _promise2.default.resolve().then(function () { | ||
return _promise.default.resolve().then(function () { | ||
return runBroker(options); | ||
@@ -97,3 +92,5 @@ }).catch(function (err) { | ||
buildConsumer(options, trigger); | ||
return { publisher: publisher }; | ||
return { | ||
publisher: publisher | ||
}; | ||
}); | ||
@@ -104,7 +101,7 @@ } | ||
var handler = function handler() {}; | ||
var config = (0, _extends3.default)({}, defaultOptions, options); | ||
var config = (0, _objectSpread2.default)({}, defaultOptions, options); | ||
var initPromise = init(config, function (event) { | ||
return handler(event); | ||
}); | ||
return { | ||
@@ -114,3 +111,3 @@ publish: function publish(event) { | ||
var publisher = _ref4.publisher; | ||
return publisher((0, _stringify2.default)(event)); | ||
return publisher((0, _stringify.default)(event)); | ||
}); | ||
@@ -126,3 +123,3 @@ }, | ||
exports.default = createAdapter; | ||
module.exports = exports['default']; | ||
var _default = createAdapter; | ||
exports.default = _default; |
{ | ||
"name": "resolve-bus-zmq", | ||
"version": "0.11.0", | ||
"version": "0.12.1", | ||
"description": "This package is an adapter for resolve-bus to emit events using ZeroMQ.", | ||
@@ -24,10 +24,19 @@ "main": "./dist/index.js", | ||
"homepage": "https://github.com/reimagined/resolve/tree/master/packages/resolve-bus-rabbitmq#readme", | ||
"dependencies": { | ||
"zeromq": "^4.6.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"jest": "^22.1.4", | ||
"sinon": "^3.3.0" | ||
}, | ||
"dependencies": { | ||
"zeromq": "^4.2.1" | ||
"@babel/cli": "^7.0.0-beta.49", | ||
"@babel/core": "^7.0.0-beta.49", | ||
"@babel/plugin-transform-runtime": "^7.0.0-beta.49", | ||
"@babel/preset-env": "^7.0.0-beta.49", | ||
"@babel/preset-react": "^7.0.0-beta.49", | ||
"@babel/preset-stage-0": "^7.0.0-beta.49", | ||
"babel-core": "^7.0.0-0", | ||
"babel-jest": "^23.0.0", | ||
"regenerator-runtime": "^0.11.1", | ||
"jest": "^23.0.1", | ||
"chai": "^4.1.2", | ||
"sinon": "^5.0.10" | ||
} | ||
} |
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
5534
5
12
93
Updatedzeromq@^4.6.0