New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rabbitmq-queue-stream

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rabbitmq-queue-stream - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

15

index.js

@@ -149,4 +149,5 @@ var _ = require("lodash");

/*
* NOTE: A proper disconnection routine from rabbitMQ should be
* NOTE: A graceful disconnection routine from rabbitMQ should be
* done in the following order:

@@ -165,2 +166,14 @@ *

/*
* Helper method that strings together the above disconnection
* routine.
*/
AMQPStreams.prototype.gracefulDisconnect = function(cb) {
async.series([
this.unsubscribeConsumers.bind(this),
this.closeConsumers.bind(this),
this.disconnect.bind(this)
], cb);
};
/*
* Stops fetching messages from the queue. Channels are kept open.

@@ -167,0 +180,0 @@ * Use AMQPStreams#closeConsumers to close the channels to queue.

2

package.json
{
"name": "rabbitmq-queue-stream",
"version": "0.4.0",
"version": "0.4.1",
"description": "Reliable streaming interface to rabbitmq queues",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -91,23 +91,8 @@ # rabbitmq-queue-stream

/* example graceful shutdown routine */
var gracefulShutdown = function() {
//stop fetching messages
streamifiedQueues.unsubscribeConsumers(function(err) {
if(err) {
//handle error
}
//Wait some time for queues to flush out before closing consumers.
streamifiedQueues.closeConsumers(function(err) {
if(err) {
//handle error
}
streamifiedQueues.disconnect(function(err) {
if(err) {
//handle error
}
process.exit(0);
});
});
process.on("SIGTERM", function() {
streamifiedQueues.gracefulDisconnect(function(err) {
// process.exit
});
};
});
});

@@ -114,0 +99,0 @@ ```

@@ -204,3 +204,3 @@ var EventEmitter = require("events").EventEmitter;

var streams = [];
_.times(4, function() {
_.times(6, function() {
streams.push({

@@ -325,2 +325,24 @@ unsubscribe: sinon.stub().yields(null),

describe("#gracefulDisconnect", function() {
beforeEach(function() {
queueStreams.unsubscribeConsumers = sinon.stub().yields(null);
queueStreams.closeConsumers = sinon.stub().yields(null);
queueStreams.disconnect = sinon.stub().yields(null);
});
it("calls #unsubscribeConsumers, #closeConsumers, #disconnect", function(done) {
queueStreams.gracefulDisconnect(function(err) {
expect(err).to.not.be.ok();
// queueStreams.channels.forEach(function(channel) {
// expect(channel.disconnect.callCount).to.be(1);
// });
expect(queueStreams.unsubscribeConsumers.callCount).to.be(1);
expect(queueStreams.closeConsumers.callCount).to.be(1);
expect(queueStreams.disconnect.callCount).to.be(1);
done();
});
});
});
describe("#resubscribeConsumers", function() {

@@ -327,0 +349,0 @@ beforeEach(function() {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc