@twilson63/palmetto-rmq
Advanced tools
Comparing version 1.1.0 to 1.2.0
39
index.js
@@ -12,19 +12,42 @@ var servicebus = require('servicebus') | ||
establishConnection(config, ee); | ||
return ee | ||
} | ||
function establishConnection(config, ee) { | ||
var bus = servicebus.bus({ | ||
url: config.endpoint, | ||
vhost: config.vhost || null | ||
}); | ||
bus.on('error', (err) => { | ||
ee.emit('error', err); | ||
}); | ||
// If this is a reconnection, the old listener is being replaced | ||
ee.removeAllListeners(['send']); | ||
ee.on('send', function (event) { | ||
config.roundRobin ? bus.send(config.app, event) : bus.publish(config.app, event); | ||
}) | ||
if (!config.publishOnly) { | ||
config.roundRobin ? bus.listen(config.app, notify) : bus.subscribe(config.app, notify); | ||
function notify (event) { | ||
if (event.to) ee.emit(event.to, event) | ||
} | ||
if (config.roundRobin) { | ||
bus.listen(config.app, notify); | ||
} else { | ||
bus.subscribe(config.app, notify); | ||
} | ||
} | ||
function notify (event) { | ||
if (event.to) ee.emit(event.to, event) | ||
// Automatically reconnect on closed connections (true by default) | ||
if (config.reconnect !== false) { | ||
bus.on('connection_close', () => { | ||
bus = establishConnection(config, ee); | ||
}); | ||
} | ||
return bus; | ||
} | ||
ee.on('send', function (event) { | ||
config.roundRobin ? bus.send(config.app, event) : bus.publish(config.app, event); | ||
}) | ||
return ee | ||
} |
{ | ||
"name": "@twilson63/palmetto-rmq", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -17,4 +17,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"servicebus": "^1.0.15" | ||
"servicebus": "https://github.com/ryanvm/servicebus.git#feature/expose-addtional-channel-conn-events" | ||
} | ||
} |
@@ -14,3 +14,4 @@ var test = require('tap').test | ||
}, | ||
send: function () {} | ||
send: function () {}, | ||
on: function() {} | ||
} | ||
@@ -17,0 +18,0 @@ } |
@@ -14,3 +14,4 @@ var test = require('tap').test | ||
} | ||
}, | ||
on: function() {} | ||
} | ||
@@ -26,2 +27,2 @@ } | ||
t.end() | ||
}) | ||
}) |
@@ -13,3 +13,4 @@ var test = require('tap').test | ||
t.deepEquals(e, { to: 'widget.request.create', name: 'foobar'}, 'should equal object') | ||
} | ||
}, | ||
on: function() {} | ||
} | ||
@@ -27,2 +28,2 @@ } | ||
t.end() | ||
}) | ||
}) |
@@ -14,3 +14,4 @@ var test = require('tap').test | ||
}, | ||
publish: function () {} | ||
publish: function () {}, | ||
on: function() {} | ||
} | ||
@@ -17,0 +18,0 @@ } |
Sorry, the diff of this file is not supported yet
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
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
8044
9
143
1
- Removedamqplib@0.4.2(transitive)
- Removedbitsyntax@0.0.4(transitive)
- Removedbuffer-more-ints@0.0.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@2.6.9(transitive)
- Removedextend@3.0.2(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@0.0.1(transitive)
- Removedms@2.0.0(transitive)
- Removednanoid@2.1.11(transitive)
- Removednode-uuid@1.4.8(transitive)
- Removedreadable-id@0.0.3(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedservicebus@1.0.21(transitive)
- Removedshortid@2.2.16(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedwhen@3.6.4(transitive)
Updatedservicebus@https://github.com/ryanvm/servicebus.git#feature/expose-addtional-channel-conn-events