@azteam/rabbitmq-async 1.0.213 → 1.0.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Provider.js +1 -3
- package/lib/RabbitMQAsync.js +1 -2
- package/package.json +1 -1
- package/src/Provider.js +2 -4
- package/src/RabbitMQAsync.js +2 -3
package/lib/Provider.js
CHANGED
|
@@ -19,11 +19,9 @@ var Provider = /*#__PURE__*/function () {
|
|
|
19
19
|
function Provider() {
|
|
20
20
|
var _this = this;
|
|
21
21
|
var configs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
22
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
23
22
|
_classCallCheck(this, Provider);
|
|
24
23
|
this.connections = {};
|
|
25
24
|
this.configs = {};
|
|
26
|
-
this.options = options;
|
|
27
25
|
if (Array.isArray(configs)) {
|
|
28
26
|
configs.map(function (config) {
|
|
29
27
|
_this.configs[config.name] = config;
|
|
@@ -39,7 +37,7 @@ var Provider = /*#__PURE__*/function () {
|
|
|
39
37
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'main';
|
|
40
38
|
if (!this.connections[name]) {
|
|
41
39
|
if (this.configs[name]) {
|
|
42
|
-
this.connections[name] = new _RabbitMQAsync["default"](this.configs[name]
|
|
40
|
+
this.connections[name] = new _RabbitMQAsync["default"](this.configs[name]);
|
|
43
41
|
} else {
|
|
44
42
|
return this.getConnection('main');
|
|
45
43
|
}
|
package/lib/RabbitMQAsync.js
CHANGED
|
@@ -23,7 +23,6 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
23
23
|
var RabbitMQAsync = /*#__PURE__*/function () {
|
|
24
24
|
function RabbitMQAsync(config) {
|
|
25
25
|
var _this = this;
|
|
26
|
-
var retryKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'RETRY';
|
|
27
26
|
_classCallCheck(this, RabbitMQAsync);
|
|
28
27
|
this.connected = false;
|
|
29
28
|
this.username = config.username;
|
|
@@ -31,8 +30,8 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
31
30
|
this.host = config.host;
|
|
32
31
|
this.prefix = config.prefix;
|
|
33
32
|
this.serverIp = config.server_ip;
|
|
33
|
+
this.retryKey = config.retry_key;
|
|
34
34
|
this.listConsume = [];
|
|
35
|
-
this.retryKey = retryKey;
|
|
36
35
|
this.client = null;
|
|
37
36
|
this.channel = null;
|
|
38
37
|
setInterval( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
package/package.json
CHANGED
package/src/Provider.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import RabbitMQAsync from './RabbitMQAsync';
|
|
2
2
|
|
|
3
3
|
class Provider {
|
|
4
|
-
constructor(configs = []
|
|
4
|
+
constructor(configs = []) {
|
|
5
5
|
this.connections = {};
|
|
6
6
|
this.configs = {};
|
|
7
7
|
|
|
8
|
-
this.options = options;
|
|
9
|
-
|
|
10
8
|
if (Array.isArray(configs)) {
|
|
11
9
|
configs.map((config) => {
|
|
12
10
|
this.configs[config.name] = config;
|
|
@@ -20,7 +18,7 @@ class Provider {
|
|
|
20
18
|
getConnection(name = 'main') {
|
|
21
19
|
if (!this.connections[name]) {
|
|
22
20
|
if (this.configs[name]) {
|
|
23
|
-
this.connections[name] = new RabbitMQAsync(this.configs[name]
|
|
21
|
+
this.connections[name] = new RabbitMQAsync(this.configs[name]);
|
|
24
22
|
} else {
|
|
25
23
|
return this.getConnection('main');
|
|
26
24
|
}
|
package/src/RabbitMQAsync.js
CHANGED
|
@@ -4,18 +4,17 @@ import _ from 'lodash';
|
|
|
4
4
|
import {timeout} from '@azteam/util';
|
|
5
5
|
|
|
6
6
|
class RabbitMQAsync {
|
|
7
|
-
constructor(config
|
|
7
|
+
constructor(config) {
|
|
8
8
|
this.connected = false;
|
|
9
9
|
this.username = config.username;
|
|
10
10
|
this.password = config.password;
|
|
11
11
|
this.host = config.host;
|
|
12
12
|
this.prefix = config.prefix;
|
|
13
13
|
this.serverIp = config.server_ip;
|
|
14
|
+
this.retryKey = config.retry_key;
|
|
14
15
|
|
|
15
16
|
this.listConsume = [];
|
|
16
17
|
|
|
17
|
-
this.retryKey = retryKey;
|
|
18
|
-
|
|
19
18
|
this.client = null;
|
|
20
19
|
this.channel = null;
|
|
21
20
|
|