Socket
Socket
Sign inDemoInstall

amqp-connection-manager

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amqp-connection-manager - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

.github/workflows/github-ci.yaml

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"a7e3a119-2a8c-44cf-8209-927ee1d36caa":{"parent":null,"children":[]},"c0823e86-c107-4a0a-8706-b14eb9b18f67":{"parent":null,"children":["f4ce670c-ed06-4884-9015-c86d83f0ea83"]},"f4ce670c-ed06-4884-9015-c86d83f0ea83":{"parent":"c0823e86-c107-4a0a-8706-b14eb9b18f67","children":[]}},"files":{"/home/travis/build/benbria/node-amqp-connection-manager/src/AmqpConnectionManager.js":["a7e3a119-2a8c-44cf-8209-927ee1d36caa","f4ce670c-ed06-4884-9015-c86d83f0ea83"],"/home/travis/build/benbria/node-amqp-connection-manager/src/ChannelWrapper.js":["a7e3a119-2a8c-44cf-8209-927ee1d36caa","f4ce670c-ed06-4884-9015-c86d83f0ea83"],"/home/travis/build/benbria/node-amqp-connection-manager/src/helpers.js":["a7e3a119-2a8c-44cf-8209-927ee1d36caa","f4ce670c-ed06-4884-9015-c86d83f0ea83"],"/home/travis/build/benbria/node-amqp-connection-manager/src/index.js":["a7e3a119-2a8c-44cf-8209-927ee1d36caa","f4ce670c-ed06-4884-9015-c86d83f0ea83"]},"externalIds":{}}
{"processes":{"2176b07c-e7ef-44b0-a792-6720ea27aacb":{"parent":null,"children":[]},"d46e8f66-96d8-4c84-b8f5-b901f66bb9bc":{"parent":null,"children":[]}},"files":{"/home/runner/work/node-amqp-connection-manager/node-amqp-connection-manager/src/ChannelWrapper.js":["2176b07c-e7ef-44b0-a792-6720ea27aacb","d46e8f66-96d8-4c84-b8f5-b901f66bb9bc"],"/home/runner/work/node-amqp-connection-manager/node-amqp-connection-manager/src/helpers.js":["2176b07c-e7ef-44b0-a792-6720ea27aacb","d46e8f66-96d8-4c84-b8f5-b901f66bb9bc"],"/home/runner/work/node-amqp-connection-manager/node-amqp-connection-manager/src/AmqpConnectionManager.js":["2176b07c-e7ef-44b0-a792-6720ea27aacb","d46e8f66-96d8-4c84-b8f5-b901f66bb9bc"],"/home/runner/work/node-amqp-connection-manager/node-amqp-connection-manager/src/index.js":["2176b07c-e7ef-44b0-a792-6720ea27aacb","d46e8f66-96d8-4c84-b8f5-b901f66bb9bc"]},"externalIds":{}}

@@ -1,9 +0,17 @@

# [3.2.0](https://github.com/benbria/node-amqp-connection-manager/compare/v3.1.1...v3.2.0) (2020-01-20)
## [3.2.1](https://github.com/jwalton/node-amqp-connection-manager/compare/v3.2.0...v3.2.1) (2020-09-12)
### Bug Fixes
* Push never resolves if error occured (courtesy @SSANSH). ([48a78f8](https://github.com/jwalton/node-amqp-connection-manager/commit/48a78f8de5d39002035b37f27fc3e0ce5015490c))
* **package:** resolve hanging retry connection timeout by introducing cancelable timeout ([e37dd1a](https://github.com/jwalton/node-amqp-connection-manager/commit/e37dd1a4e423012910d31ae8bcebf781cac6f3b5))
# [3.2.0](https://github.com/jwalton/node-amqp-connection-manager/compare/v3.1.1...v3.2.0) (2020-01-20)
### Features
* add bindQueue and assertExchange on ChannelWrapper ([879e522](https://github.com/benbria/node-amqp-connection-manager/commit/879e522))
* add bindQueue and assertExchange on ChannelWrapper ([879e522](https://github.com/jwalton/node-amqp-connection-manager/commit/879e522))
## [3.1.1](https://github.com/benbria/node-amqp-connection-manager/compare/v3.1.0...v3.1.1) (2020-01-06)
## [3.1.1](https://github.com/jwalton/node-amqp-connection-manager/compare/v3.1.0...v3.1.1) (2020-01-06)

@@ -13,5 +21,5 @@

* typo ([6055b02](https://github.com/benbria/node-amqp-connection-manager/commit/6055b02))
* typo ([6055b02](https://github.com/jwalton/node-amqp-connection-manager/commit/6055b02))
# [3.1.0](https://github.com/benbria/node-amqp-connection-manager/compare/v3.0.0...v3.1.0) (2019-12-06)
# [3.1.0](https://github.com/jwalton/node-amqp-connection-manager/compare/v3.0.0...v3.1.0) (2019-12-06)

@@ -21,5 +29,5 @@

* Allow using URL object to connect, same format as amqplib accepts. ([f046680](https://github.com/benbria/node-amqp-connection-manager/commit/f046680))
* Allow using URL object to connect, same format as amqplib accepts. ([f046680](https://github.com/jwalton/node-amqp-connection-manager/commit/f046680))
# [3.0.0](https://github.com/benbria/node-amqp-connection-manager/compare/v2.3.3...v3.0.0) (2019-07-04)
# [3.0.0](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.3.3...v3.0.0) (2019-07-04)

@@ -29,3 +37,3 @@

* Stop running tests for node 6 and node 8. ([164b882](https://github.com/benbria/node-amqp-connection-manager/commit/164b882))
* Stop running tests for node 6 and node 8. ([164b882](https://github.com/jwalton/node-amqp-connection-manager/commit/164b882))

@@ -38,3 +46,3 @@

## [2.3.3](https://github.com/benbria/node-amqp-connection-manager/compare/v2.3.2...v2.3.3) (2019-06-25)
## [2.3.3](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.3.2...v2.3.3) (2019-06-25)

@@ -44,5 +52,5 @@

* **package:** update promise-breaker to version 5.0.0 ([ed91042](https://github.com/benbria/node-amqp-connection-manager/commit/ed91042))
* **package:** update promise-breaker to version 5.0.0 ([ed91042](https://github.com/jwalton/node-amqp-connection-manager/commit/ed91042))
## [2.3.2](https://github.com/benbria/node-amqp-connection-manager/compare/v2.3.1...v2.3.2) (2019-05-21)
## [2.3.2](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.3.1...v2.3.2) (2019-05-21)

@@ -52,5 +60,5 @@

* Null delta to get semantic-release to pick up [#65](https://github.com/benbria/node-amqp-connection-manager/issues/65). Fix [#84](https://github.com/benbria/node-amqp-connection-manager/issues/84). ([9737135](https://github.com/benbria/node-amqp-connection-manager/commit/9737135))
* Null delta to get semantic-release to pick up [#65](https://github.com/jwalton/node-amqp-connection-manager/issues/65). Fix [#84](https://github.com/jwalton/node-amqp-connection-manager/issues/84). ([9737135](https://github.com/jwalton/node-amqp-connection-manager/commit/9737135))
## [2.3.1](https://github.com/benbria/node-amqp-connection-manager/compare/v2.3.0...v2.3.1) (2019-04-01)
## [2.3.1](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.3.0...v2.3.1) (2019-04-01)

@@ -60,5 +68,5 @@

* prevent too many connection attempts on error ([2760ce5](https://github.com/benbria/node-amqp-connection-manager/commit/2760ce5)), closes [#77](https://github.com/benbria/node-amqp-connection-manager/issues/77)
* prevent too many connection attempts on error ([2760ce5](https://github.com/jwalton/node-amqp-connection-manager/commit/2760ce5)), closes [#77](https://github.com/jwalton/node-amqp-connection-manager/issues/77)
# [2.3.0](https://github.com/benbria/node-amqp-connection-manager/compare/v2.2.0...v2.3.0) (2018-11-20)
# [2.3.0](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.2.0...v2.3.0) (2018-11-20)

@@ -68,5 +76,5 @@

* Add ChannelWrapper.ackAll() and ChannelWrapper.nackAll(). ([0246695](https://github.com/benbria/node-amqp-connection-manager/commit/0246695)), closes [#60](https://github.com/benbria/node-amqp-connection-manager/issues/60)
* Add ChannelWrapper.ackAll() and ChannelWrapper.nackAll(). ([0246695](https://github.com/jwalton/node-amqp-connection-manager/commit/0246695)), closes [#60](https://github.com/jwalton/node-amqp-connection-manager/issues/60)
# [2.2.0](https://github.com/benbria/node-amqp-connection-manager/compare/v2.1.2...v2.2.0) (2018-09-25)
# [2.2.0](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.1.2...v2.2.0) (2018-09-25)

@@ -76,5 +84,5 @@

* Set 'this' to be the channel wrapper in the setup function. ([551200f](https://github.com/benbria/node-amqp-connection-manager/commit/551200f))
* Set 'this' to be the channel wrapper in the setup function. ([551200f](https://github.com/jwalton/node-amqp-connection-manager/commit/551200f))
## [2.1.2](https://github.com/benbria/node-amqp-connection-manager/compare/v2.1.1...v2.1.2) (2018-09-13)
## [2.1.2](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.1.1...v2.1.2) (2018-09-13)

@@ -84,5 +92,5 @@

* Export a default object from root module. ([78893c9](https://github.com/benbria/node-amqp-connection-manager/commit/78893c9)), closes [#51](https://github.com/benbria/node-amqp-connection-manager/issues/51)
* Export a default object from root module. ([78893c9](https://github.com/jwalton/node-amqp-connection-manager/commit/78893c9)), closes [#51](https://github.com/jwalton/node-amqp-connection-manager/issues/51)
## [2.1.1](https://github.com/benbria/node-amqp-connection-manager/compare/v2.1.0...v2.1.1) (2018-09-05)
## [2.1.1](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.1.0...v2.1.1) (2018-09-05)

@@ -92,5 +100,5 @@

* Remove reconnection listener when closing the connection manager. ([eeb6e2b](https://github.com/benbria/node-amqp-connection-manager/commit/eeb6e2b))
* Remove reconnection listener when closing the connection manager. ([eeb6e2b](https://github.com/jwalton/node-amqp-connection-manager/commit/eeb6e2b))
# [2.1.0](https://github.com/benbria/node-amqp-connection-manager/compare/v2.0.0...v2.1.0) (2018-08-09)
# [2.1.0](https://github.com/jwalton/node-amqp-connection-manager/compare/v2.0.0...v2.1.0) (2018-08-09)

@@ -100,6 +108,6 @@

* Support for per URL connection options ([ec2d484](https://github.com/benbria/node-amqp-connection-manager/commit/ec2d484)), closes [#29](https://github.com/benbria/node-amqp-connection-manager/issues/29) [#34](https://github.com/benbria/node-amqp-connection-manager/issues/34) [#44](https://github.com/benbria/node-amqp-connection-manager/issues/44)
* Support for per URL connection options ([ec2d484](https://github.com/jwalton/node-amqp-connection-manager/commit/ec2d484)), closes [#29](https://github.com/jwalton/node-amqp-connection-manager/issues/29) [#34](https://github.com/jwalton/node-amqp-connection-manager/issues/34) [#44](https://github.com/jwalton/node-amqp-connection-manager/issues/44)
<a name="2.0.0"></a>
# [2.0.0](https://github.com/benbria/node-amqp-connection-manager/compare/v1.4.2...v2.0.0) (2018-05-05)
# [2.0.0](https://github.com/jwalton/node-amqp-connection-manager/compare/v1.4.2...v2.0.0) (2018-05-05)

@@ -109,3 +117,3 @@

* Rewrite all source in javascript. ([377d01d](https://github.com/benbria/node-amqp-connection-manager/commit/377d01d))
* Rewrite all source in javascript. ([377d01d](https://github.com/jwalton/node-amqp-connection-manager/commit/377d01d))

@@ -112,0 +120,0 @@

@@ -99,13 +99,22 @@ "use strict";

this._closed = true;
return Promise.all(this._channels.map(channel => channel.close())).catch(function () {// Ignore errors closing channels.
}).then(() => {
this._channels = [];
if (this._currentConnection) {
this._currentConnection.removeAllListeners('close');
if (this._cancelRetriesHandler) {
this._cancelRetriesHandler();
this._currentConnection.close();
}
this._cancelRetriesHandler = null;
}
this._currentConnection = null;
return Promise.resolve(this._connectPromise).then(() => {
return Promise.all(this._channels.map(channel => channel.close())).catch(function () {// Ignore errors closing channels.
}).then(() => {
this._channels = [];
if (this._currentConnection) {
this._currentConnection.removeAllListeners('close');
this._currentConnection.close();
}
this._currentConnection = null;
});
});

@@ -119,8 +128,11 @@ }

_connect() {
if (this._closed || this._connecting || this.isConnected()) {
if (this._connectPromise) {
return this._connectPromise;
}
if (this._closed || this.isConnected()) {
return Promise.resolve();
}
this._connecting = true;
return Promise.resolve().then(() => {
this._connectPromise = Promise.resolve().then(() => {
if (!this._urls || this._currentUrl >= this._urls.length) {

@@ -189,6 +201,8 @@ this._currentUrl = 0;

});
(0, _helpers.wait)(this.reconnectTimeInSeconds * 1000).then(() => this._connect()) // `_connect()` should never throw.
const handle = (0, _helpers.wait)(this.reconnectTimeInSeconds * 1000);
this._cancelRetriesHandler = handle.cancel;
handle.promise().then(() => this._connect()) // `_connect()` should never throw.
.catch(neverThrows);
});
this._connecting = false;
this._connectPromise = null;
this.emit('connect', {

@@ -205,9 +219,10 @@ connection,

this._currentConnection = null; // TODO: Probably want to try right away here, especially if there are multiple brokers to try...
this._currentConnection = null;
this._connectPromise = null; // TODO: Probably want to try right away here, especially if there are multiple brokers to try...
return (0, _helpers.wait)(this.reconnectTimeInSeconds * 1000).then(() => {
this._connecting = false;
return this._connect();
});
const handle = (0, _helpers.wait)(this.reconnectTimeInSeconds * 1000);
this._cancelRetriesHandler = handle.cancel;
return handle.promise().then(() => this._connect());
});
return this._connectPromise;
}

@@ -214,0 +229,0 @@

@@ -169,3 +169,18 @@ "use strict";

this._unconfirmedMessages = []; // True if the "worker" is busy sending messages. False if we need to
this._unconfirmedMessages = []; // Place to store reason code during publish or sendtoqueue messages.
this._irrecoverableCode = null; // Irrecoverable error.
this._irrecoverableError = [403, // AMQP Access Refused Error.
404, // AMQP Not Found Error.
406, // AMQP Precondition Failed Error.
501, // AMQP Frame Error.
502, // AMQP Frame Syntax Error.
503, // AMQP Invalid Command Error.
504, // AMQP Channel Not Open Error.
505, // AMQP Unexpected Frame.
530, // AMQP Not Allowed Error.
540, // AMQP Not Implemented Error.
541 // AMQP Internal Error.
]; // True if the "worker" is busy sending messages. False if we need to
// start the worker to get stuff done.

@@ -207,2 +222,3 @@

this._connection = connection;
this._irrecoverableCode = null;
return connection.createConfirmChannel().then(channel => {

@@ -259,3 +275,4 @@ this._channel = channel;

_onDisconnect() {
_onDisconnect(ex) {
this._irrecoverableCode = (ex.err instanceof Error ? ex.err.code : null) || null;
this._channel = null;

@@ -314,2 +331,7 @@ this._settingUp = null; // Kill off the current worker. We never get any kind of error for messages in flight - see

}
} // Define if a message can cause irrecoverable error
_canWaitReconnection() {
return !this._irrecoverableError.includes(this._irrecoverableCode);
}

@@ -373,3 +395,3 @@

}, err => {
if (!this._channel) {
if (!this._channel && this._canWaitReconnection()) {
// Tried to write to a closed channel. Leave the message in the queue and we'll try again when we

@@ -376,0 +398,0 @@ // reconnect.

@@ -9,6 +9,16 @@ "use strict";

function wait(timeInMs) {
return new Promise(function (resolve) {
return setTimeout(resolve, timeInMs);
});
let timeoutHandle;
const promise = () => {
return new Promise(function (resolve) {
timeoutHandle = setTimeout(resolve, timeInMs);
return timeoutHandle;
});
};
return {
promise,
cancel: () => clearTimeout(timeoutHandle)
};
}
//# sourceMappingURL=helpers.js.map
{
"name": "amqp-connection-manager",
"version": "3.2.0",
"version": "3.2.1",
"description": "Auto-reconnect and round robin support for amqplib.",

@@ -13,29 +13,29 @@ "main": "lib/index.js",

"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.3",
"@babel/preset-env": "^7.3.1",
"@babel/register": "^7.0.0",
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@babel/register": "^7.11.5",
"@jwalton/semantic-release-config": "^1.0.0",
"@semantic-release/changelog": "^3.0.1",
"@semantic-release/git": "^7.0.1",
"amqplib": "^0.5.1",
"babel-plugin-istanbul": "^5.1.1",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"amqplib": "^0.6.0",
"babel-plugin-istanbul": "^6.0.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-string": "^1.1.2",
"coveralls": "^3.0.0",
"cross-env": "^6.0.0",
"eslint": "^6.5.1",
"eslint-config-benbria": "^4.0.2",
"eslint-plugin-import": "^2.18.0",
"coveralls": "^3.1.0",
"cross-env": "^7.0.2",
"eslint": "^7.8.1",
"eslint-config-benbria": "^4.0.3",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-promise": "^4.2.1",
"greenkeeper-lockfile": "^1.14.0",
"husky": "^4.0.2",
"husky": "^4.3.0",
"istanbul": "^0.4.0",
"mocha": "^6.1.4",
"nyc": "^14.0.0",
"promise-tools": "^2.0.0",
"proxyquire": "^2.0.1",
"semantic-release": "^15.13.18",
"sinon": "^8.1.0"
"mocha": "^8.1.3",
"nyc": "^15.1.0",
"promise-tools": "^2.1.0",
"proxyquire": "^2.1.3",
"semantic-release": "^17.1.1",
"sinon": "^9.0.3"
},

@@ -64,3 +64,3 @@ "engines": {

"type": "git",
"url": "https://github.com/benbria/node-amqp-connection-manager"
"url": "https://github.com/jwalton/node-amqp-connection-manager"
},

@@ -76,5 +76,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/benbria/node-amqp-connection-manager/issues"
"url": "https://github.com/jwalton/node-amqp-connection-manager/issues"
},
"homepage": "https://github.com/benbria/node-amqp-connection-manager"
"homepage": "https://github.com/jwalton/node-amqp-connection-manager"
}

@@ -1,9 +0,9 @@

[![Build Status](https://travis-ci.org/benbria/node-amqp-connection-manager.svg?branch=master)](https://travis-ci.org/benbria/node-amqp-connection-manager)
[![Coverage Status](https://coveralls.io/repos/benbria/node-amqp-connection-manager/badge.svg?branch=master&service=github)](https://coveralls.io/github/benbria/node-amqp-connection-manager?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/benbria/node-amqp-connection-manager.svg)](https://greenkeeper.io/)
[![NPM version](https://badge.fury.io/js/amqp-connection-manager.svg)](https://npmjs.org/package/amqp-connection-manager)
![Build Status](https://github.com/jwalton/amqp-connection-manager/workflows/GitHub%20CI/badge.svg)
[![Coverage Status](https://coveralls.io/repos/jwalton/node-amqp-connection-manager/badge.svg?branch=master&service=github)](https://coveralls.io/github/jwalton/node-amqp-connection-manager?branch=master)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Dependency Status](https://david-dm.org/benbria/node-amqp-connection-manager.svg)](https://david-dm.org/benbria/node-amqp-connection-manager)
[![devDependency Status](https://david-dm.org/benbria/node-amqp-connection-manager/dev-status.svg)](https://david-dm.org/benbria/node-amqp-connection-manager#info=devDependencies)
[![peerDependency Status](https://david-dm.org/benbria/node-amqp-connection-manager/peer-status.svg)](https://david-dm.org/benbria/node-amqp-connection-manager#info=peerDependencies)
[![Dependency Status](https://david-dm.org/jwalton/node-amqp-connection-manager.svg)](https://david-dm.org/jwalton/node-amqp-connection-manager)
[![devDependency Status](https://david-dm.org/jwalton/node-amqp-connection-manager/dev-status.svg)](https://david-dm.org/jwalton/node-amqp-connection-manager#info=devDependencies)
[![peerDependency Status](https://david-dm.org/jwalton/node-amqp-connection-manager/peer-status.svg)](https://david-dm.org/jwalton/node-amqp-connection-manager#info=peerDependencies)

@@ -10,0 +10,0 @@ Connection management for amqplib.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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