@azteam/rabbitmq-async 1.0.220 → 1.0.222
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/RabbitMQAsync.js +41 -37
- package/package.json +1 -1
- package/src/RabbitMQAsync.js +1 -1
package/lib/RabbitMQAsync.js
CHANGED
|
@@ -328,17 +328,17 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
328
328
|
while (1) switch (_context7.prev = _context7.next) {
|
|
329
329
|
case 0:
|
|
330
330
|
if (!msg) {
|
|
331
|
-
_context7.next =
|
|
331
|
+
_context7.next = 48;
|
|
332
332
|
break;
|
|
333
333
|
}
|
|
334
334
|
data = JSON.parse(msg.content.toString());
|
|
335
335
|
if (!data) {
|
|
336
|
-
_context7.next =
|
|
336
|
+
_context7.next = 47;
|
|
337
337
|
break;
|
|
338
338
|
}
|
|
339
339
|
_context7.prev = 3;
|
|
340
340
|
if (!msg.fields.redelivered) {
|
|
341
|
-
_context7.next =
|
|
341
|
+
_context7.next = 18;
|
|
342
342
|
break;
|
|
343
343
|
}
|
|
344
344
|
data.retry -= 1;
|
|
@@ -349,78 +349,82 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
349
349
|
_context7.next = 9;
|
|
350
350
|
return messageQueue.send(queueName, data);
|
|
351
351
|
case 9:
|
|
352
|
-
_context7.next =
|
|
352
|
+
_context7.next = 14;
|
|
353
353
|
break;
|
|
354
354
|
case 11:
|
|
355
|
-
|
|
355
|
+
if (data.notCheck) {
|
|
356
|
+
_context7.next = 14;
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
_context7.next = 14;
|
|
356
360
|
return messageQueue.send(messageQueue.parsePrefix(messageQueue.retryKey), {
|
|
357
361
|
queueName: queueName,
|
|
358
362
|
data: data,
|
|
359
363
|
retry_time: new Date(),
|
|
360
364
|
ip: messageQueue.serverIp
|
|
361
365
|
});
|
|
362
|
-
case
|
|
363
|
-
_context7.next =
|
|
366
|
+
case 14:
|
|
367
|
+
_context7.next = 16;
|
|
364
368
|
return channel.ack(msg);
|
|
365
|
-
case
|
|
366
|
-
_context7.next =
|
|
369
|
+
case 16:
|
|
370
|
+
_context7.next = 40;
|
|
367
371
|
break;
|
|
368
|
-
case
|
|
369
|
-
_context7.prev =
|
|
370
|
-
_context7.next =
|
|
372
|
+
case 18:
|
|
373
|
+
_context7.prev = 18;
|
|
374
|
+
_context7.next = 21;
|
|
371
375
|
return asyncFunction(data);
|
|
372
|
-
case
|
|
373
|
-
_context7.next =
|
|
376
|
+
case 21:
|
|
377
|
+
_context7.next = 23;
|
|
374
378
|
return channel.ack(msg);
|
|
375
|
-
case
|
|
376
|
-
_context7.next =
|
|
379
|
+
case 23:
|
|
380
|
+
_context7.next = 40;
|
|
377
381
|
break;
|
|
378
|
-
case
|
|
379
|
-
_context7.prev =
|
|
380
|
-
_context7.t0 = _context7["catch"](
|
|
382
|
+
case 25:
|
|
383
|
+
_context7.prev = 25;
|
|
384
|
+
_context7.t0 = _context7["catch"](18);
|
|
381
385
|
errString = _context7.t0.toString();
|
|
382
386
|
if (!_lodash["default"].some(['Channel closed', 'Channel closing'], function (el) {
|
|
383
387
|
return _lodash["default"].includes(errString, el);
|
|
384
388
|
})) {
|
|
385
|
-
_context7.next =
|
|
389
|
+
_context7.next = 32;
|
|
386
390
|
break;
|
|
387
391
|
}
|
|
388
392
|
reject(_context7.t0);
|
|
389
|
-
_context7.next =
|
|
393
|
+
_context7.next = 40;
|
|
390
394
|
break;
|
|
391
|
-
case
|
|
395
|
+
case 32:
|
|
392
396
|
if (callbackError && data.retry === 1) {
|
|
393
397
|
callbackError(prefixQueueName, errString);
|
|
394
398
|
}
|
|
395
399
|
if (!(data.retry <= 0)) {
|
|
396
|
-
_context7.next =
|
|
400
|
+
_context7.next = 38;
|
|
397
401
|
break;
|
|
398
402
|
}
|
|
399
|
-
_context7.next =
|
|
403
|
+
_context7.next = 36;
|
|
400
404
|
return channel.ack(msg);
|
|
401
|
-
case
|
|
402
|
-
_context7.next =
|
|
405
|
+
case 36:
|
|
406
|
+
_context7.next = 40;
|
|
403
407
|
break;
|
|
404
|
-
case
|
|
405
|
-
_context7.next =
|
|
408
|
+
case 38:
|
|
409
|
+
_context7.next = 40;
|
|
406
410
|
return channel.nack(msg);
|
|
407
|
-
case
|
|
408
|
-
_context7.next =
|
|
411
|
+
case 40:
|
|
412
|
+
_context7.next = 45;
|
|
409
413
|
break;
|
|
410
|
-
case
|
|
411
|
-
_context7.prev =
|
|
414
|
+
case 42:
|
|
415
|
+
_context7.prev = 42;
|
|
412
416
|
_context7.t1 = _context7["catch"](3);
|
|
413
417
|
reject(_context7.t1);
|
|
414
|
-
case
|
|
415
|
-
_context7.next =
|
|
418
|
+
case 45:
|
|
419
|
+
_context7.next = 48;
|
|
416
420
|
break;
|
|
417
|
-
case 46:
|
|
418
|
-
channel.ack(msg);
|
|
419
421
|
case 47:
|
|
422
|
+
channel.ack(msg);
|
|
423
|
+
case 48:
|
|
420
424
|
case "end":
|
|
421
425
|
return _context7.stop();
|
|
422
426
|
}
|
|
423
|
-
}, _callee7, null, [[3,
|
|
427
|
+
}, _callee7, null, [[3, 42], [18, 25]]);
|
|
424
428
|
}));
|
|
425
429
|
return function (_x5) {
|
|
426
430
|
return _ref2.apply(this, arguments);
|
package/package.json
CHANGED
package/src/RabbitMQAsync.js
CHANGED
|
@@ -139,7 +139,7 @@ class RabbitMQAsync {
|
|
|
139
139
|
data.retry -= 1;
|
|
140
140
|
if (data.retry > 0) {
|
|
141
141
|
await messageQueue.send(queueName, data);
|
|
142
|
-
} else {
|
|
142
|
+
} else if (!data.notCheck) {
|
|
143
143
|
await messageQueue.send(messageQueue.parsePrefix(messageQueue.retryKey), {
|
|
144
144
|
queueName,
|
|
145
145
|
data,
|