@azteam/rabbitmq-async 1.0.209 → 1.0.210

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.
@@ -209,46 +209,40 @@ var RabbitMQAsync = /*#__PURE__*/function () {
209
209
  _context5.prev = 2;
210
210
  prefixQueueName = this.parsePrefix(queueName);
211
211
  if (!this.connected) {
212
- _context5.next = 16;
212
+ _context5.next = 12;
213
213
  break;
214
214
  }
215
- _context5.next = 7;
216
- return this.client.createChannel();
217
- case 7:
218
- channel = _context5.sent;
219
- _context5.next = 10;
215
+ channel = this.channel;
216
+ _context5.next = 8;
220
217
  return this.channel.assertQueue(prefixQueueName, {
221
218
  durable: true
222
219
  });
223
- case 10:
220
+ case 8:
224
221
  queueInfo = _context5.sent;
225
222
  if (!(limit === 0 || queueInfo.messageCount < limit)) {
226
- _context5.next = 16;
223
+ _context5.next = 12;
227
224
  break;
228
225
  }
229
- _context5.next = 14;
226
+ _context5.next = 12;
230
227
  return channel.sendToQueue(prefixQueueName, Buffer.from(JSON.stringify(_objectSpread({
231
228
  retry: 5
232
229
  }, msg))), {
233
230
  persistent: true
234
231
  });
235
- case 14:
236
- _context5.next = 16;
237
- return channel.close();
238
- case 16:
232
+ case 12:
239
233
  return _context5.abrupt("return", true);
240
- case 19:
241
- _context5.prev = 19;
234
+ case 15:
235
+ _context5.prev = 15;
242
236
  _context5.t0 = _context5["catch"](2);
243
- _context5.next = 23;
237
+ _context5.next = 19;
244
238
  return (0, _util.timeout)(2000);
245
- case 23:
239
+ case 19:
246
240
  return _context5.abrupt("return", this.send(queueName, msg));
247
- case 24:
241
+ case 20:
248
242
  case "end":
249
243
  return _context5.stop();
250
244
  }
251
- }, _callee5, this, [[2, 19]]);
245
+ }, _callee5, this, [[2, 15]]);
252
246
  }));
253
247
  function send(_x) {
254
248
  return _send.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/rabbitmq-async",
3
- "version": "1.0.209",
3
+ "version": "1.0.210",
4
4
  "description": "N/A",
5
5
  "keywords": [
6
6
  "toda",
@@ -85,7 +85,7 @@ class RabbitMQAsync {
85
85
  try {
86
86
  const prefixQueueName = this.parsePrefix(queueName);
87
87
  if (this.connected) {
88
- const channel = await this.client.createChannel(),
88
+ const {channel} = this,
89
89
  queueInfo = await this.channel.assertQueue(prefixQueueName, {
90
90
  durable: true,
91
91
  });
@@ -94,7 +94,6 @@ class RabbitMQAsync {
94
94
  await channel.sendToQueue(prefixQueueName, Buffer.from(JSON.stringify({retry: 5, ...msg})), {
95
95
  persistent: true,
96
96
  });
97
- await channel.close();
98
97
  }
99
98
  }
100
99