From 08bb169d32bcf7451d5ffb63103dd8792d4eeea6 Mon Sep 17 00:00:00 2001 From: Vish Desai Date: Tue, 13 Feb 2018 17:44:01 +0530 Subject: [PATCH 1/7] Allow queue name to be specified in AMQPLib configuration --- lib/amqplib_ascoltatore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/amqplib_ascoltatore.js b/lib/amqplib_ascoltatore.js index 8ee8cc2..f2cd9e3 100644 --- a/lib/amqplib_ascoltatore.js +++ b/lib/amqplib_ascoltatore.js @@ -92,7 +92,7 @@ AMQPLibAscoltatore.prototype._startConn = function () { function(callback){ debug('channel created'); - that._queue = util.buildIdentifier(); + that._queue = that._opts.exchange || util.buildIdentifier(); that._channel.assertQueue(that._queue, {durable: false}, wrap(callback)); }, From abd03f3e2661e91655865e807f346267fa41fe64 Mon Sep 17 00:00:00 2001 From: Vish Desai Date: Tue, 13 Feb 2018 17:55:14 +0530 Subject: [PATCH 2/7] Minor change --- lib/amqplib_ascoltatore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/amqplib_ascoltatore.js b/lib/amqplib_ascoltatore.js index f2cd9e3..2aa4454 100644 --- a/lib/amqplib_ascoltatore.js +++ b/lib/amqplib_ascoltatore.js @@ -92,8 +92,8 @@ AMQPLibAscoltatore.prototype._startConn = function () { function(callback){ debug('channel created'); - that._queue = that._opts.exchange || util.buildIdentifier(); - that._channel.assertQueue(that._queue, {durable: false}, wrap(callback)); + that._queue = that._opts.queue || util.buildIdentifier(); + that._channel.assertQueue(that._queue, {durable: (that._opts.durableQueue !== false)}, wrap(callback)); }, function (callback){ From 2000da39748fad2dd7cce6777d0f3394a0d30eed Mon Sep 17 00:00:00 2001 From: Vish Desai Date: Tue, 13 Feb 2018 18:04:09 +0530 Subject: [PATCH 3/7] Minor change --- lib/amqplib_ascoltatore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/amqplib_ascoltatore.js b/lib/amqplib_ascoltatore.js index 2aa4454..855596e 100644 --- a/lib/amqplib_ascoltatore.js +++ b/lib/amqplib_ascoltatore.js @@ -145,7 +145,7 @@ AMQPLibAscoltatore.prototype.subscribe = function subscribe(topic, callback, don AMQPLibAscoltatore.prototype.publish = function publish(topic, message, done) { this._raiseIfClosed(); - debug("new message published to " + topic); + debug("new message published to " + this._pubTopic(topic)); this._channel.publish(this._opts.exchange, this._pubTopic(topic), new Buffer(String(message))); defer(done); From 7331b9e1b2a990f8d13a98fe4037663c56566ee7 Mon Sep 17 00:00:00 2001 From: Vish Desai Date: Wed, 14 Feb 2018 08:13:01 +0530 Subject: [PATCH 4/7] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 497c65c..7272390 100644 --- a/README.md +++ b/README.md @@ -237,7 +237,9 @@ var settings = { type: 'amqplib', json: false, amqp: require('amqplib/callback_api'), - exchange: 'ascolatore5672' + exchange: 'ascolatore5672', + queue: 'queueName', + durableQueue: true }; ascoltatori.build(settings, function (err, ascoltatore) { From c1d6f9c376040c616866cfceb13913a76bb0301d Mon Sep 17 00:00:00 2001 From: Vish Desai Date: Wed, 14 Feb 2018 08:44:28 +0530 Subject: [PATCH 5/7] Update amqplib_ascoltatore.js --- lib/amqplib_ascoltatore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/amqplib_ascoltatore.js b/lib/amqplib_ascoltatore.js index 855596e..fd81a02 100644 --- a/lib/amqplib_ascoltatore.js +++ b/lib/amqplib_ascoltatore.js @@ -93,7 +93,7 @@ AMQPLibAscoltatore.prototype._startConn = function () { function(callback){ debug('channel created'); that._queue = that._opts.queue || util.buildIdentifier(); - that._channel.assertQueue(that._queue, {durable: (that._opts.durableQueue !== false)}, wrap(callback)); + that._channel.assertQueue(that._queue, {durable: !!that._opts.durableQueue}, wrap(callback)); }, function (callback){ From e6f696a474b08b0a62ba35aab71c26ef79072df2 Mon Sep 17 00:00:00 2001 From: Vish Desai Date: Wed, 14 Feb 2018 08:56:58 +0530 Subject: [PATCH 6/7] Updated path to Kafka Tests are failing because the script cannot fetch an Apache Kafka tarball. Updated path to the correct one --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e2b77e7..bb512a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ before_install: - mkdir -p data/db - mongod --dbpath=data/db > /dev/null & - sleep 5 - - wget http://www.us.apache.org/dist/kafka/0.9.0.1/kafka_2.11-0.9.0.1.tgz -O kafka.tgz + - wget http://www.us.apache.org/dist/kafka/0.11.0.2/kafka_2.12-0.11.0.2.tgz -O kafka.tgz - mkdir -p kafka && tar xzf kafka.tgz -C kafka --strip-components 1 - nohup bash -c "cd kafka && bin/zookeeper-server-start.sh config/zookeeper.properties &" - sleep 10 From 91a6bd492750c19545542965929a28ce569b1ba2 Mon Sep 17 00:00:00 2001 From: Vish Desai Date: Thu, 15 Feb 2018 08:21:21 +0530 Subject: [PATCH 7/7] Added options for conditional queue delete --- lib/amqplib_ascoltatore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/amqplib_ascoltatore.js b/lib/amqplib_ascoltatore.js index fd81a02..8e2df62 100644 --- a/lib/amqplib_ascoltatore.js +++ b/lib/amqplib_ascoltatore.js @@ -199,7 +199,7 @@ AMQPLibAscoltatore.prototype.close = function close(done) { }; this._client_conn.on("close", doClose); - this._channel.deleteQueue(this._queue); + this._channel.deleteQueue(this._queue, { "ifUnused": true, "ifEmpty": true }); this._channel.close(); this._client_conn.close();