@azteam/rabbitmq-async 1.0.164 → 1.0.166
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 +165 -111
- package/package.json +7 -7
- package/src/RabbitMQAsync.js +8 -0
package/lib/RabbitMQAsync.js
CHANGED
|
@@ -250,9 +250,9 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
250
250
|
return send;
|
|
251
251
|
}()
|
|
252
252
|
}, {
|
|
253
|
-
key: "
|
|
253
|
+
key: "selfSend",
|
|
254
254
|
value: function () {
|
|
255
|
-
var
|
|
255
|
+
var _selfSend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(queueName) {
|
|
256
256
|
var msg,
|
|
257
257
|
limit,
|
|
258
258
|
_args5 = arguments;
|
|
@@ -262,76 +262,130 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
262
262
|
case 0:
|
|
263
263
|
msg = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
264
264
|
limit = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : 0;
|
|
265
|
+
this.send("".concat(this.serverIp, "_").concat(queueName), msg, limit);
|
|
266
|
+
case 3:
|
|
267
|
+
case "end":
|
|
268
|
+
return _context5.stop();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}, _callee5, this);
|
|
272
|
+
}));
|
|
273
|
+
function selfSend(_x2) {
|
|
274
|
+
return _selfSend.apply(this, arguments);
|
|
275
|
+
}
|
|
276
|
+
return selfSend;
|
|
277
|
+
}()
|
|
278
|
+
}, {
|
|
279
|
+
key: "sendNoRetry",
|
|
280
|
+
value: function () {
|
|
281
|
+
var _sendNoRetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(queueName) {
|
|
282
|
+
var msg,
|
|
283
|
+
limit,
|
|
284
|
+
_args6 = arguments;
|
|
285
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
286
|
+
while (1) {
|
|
287
|
+
switch (_context6.prev = _context6.next) {
|
|
288
|
+
case 0:
|
|
289
|
+
msg = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
290
|
+
limit = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : 0;
|
|
265
291
|
this.send(queueName, _objectSpread(_objectSpread({}, msg), {}, {
|
|
266
292
|
noRetry: true
|
|
267
293
|
}), limit);
|
|
268
294
|
case 3:
|
|
269
295
|
case "end":
|
|
270
|
-
return
|
|
296
|
+
return _context6.stop();
|
|
271
297
|
}
|
|
272
298
|
}
|
|
273
|
-
},
|
|
299
|
+
}, _callee6, this);
|
|
274
300
|
}));
|
|
275
|
-
function sendNoRetry(
|
|
301
|
+
function sendNoRetry(_x3) {
|
|
276
302
|
return _sendNoRetry.apply(this, arguments);
|
|
277
303
|
}
|
|
278
304
|
return sendNoRetry;
|
|
279
305
|
}()
|
|
306
|
+
}, {
|
|
307
|
+
key: "selfSendNoRetry",
|
|
308
|
+
value: function () {
|
|
309
|
+
var _selfSendNoRetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(queueName) {
|
|
310
|
+
var msg,
|
|
311
|
+
limit,
|
|
312
|
+
_args7 = arguments;
|
|
313
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
314
|
+
while (1) {
|
|
315
|
+
switch (_context7.prev = _context7.next) {
|
|
316
|
+
case 0:
|
|
317
|
+
msg = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
318
|
+
limit = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : 0;
|
|
319
|
+
this.selfSend(queueName, _objectSpread(_objectSpread({}, msg), {}, {
|
|
320
|
+
noRetry: true
|
|
321
|
+
}), limit);
|
|
322
|
+
case 3:
|
|
323
|
+
case "end":
|
|
324
|
+
return _context7.stop();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}, _callee7, this);
|
|
328
|
+
}));
|
|
329
|
+
function selfSendNoRetry(_x4) {
|
|
330
|
+
return _selfSendNoRetry.apply(this, arguments);
|
|
331
|
+
}
|
|
332
|
+
return selfSendNoRetry;
|
|
333
|
+
}()
|
|
280
334
|
}, {
|
|
281
335
|
key: "getInfo",
|
|
282
336
|
value: function () {
|
|
283
|
-
var _getInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
337
|
+
var _getInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(queueName) {
|
|
284
338
|
var prefixQueueName, channel;
|
|
285
|
-
return _regeneratorRuntime().wrap(function
|
|
339
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
286
340
|
while (1) {
|
|
287
|
-
switch (
|
|
341
|
+
switch (_context8.prev = _context8.next) {
|
|
288
342
|
case 0:
|
|
289
343
|
prefixQueueName = this.parsePrefix(queueName);
|
|
290
344
|
if (!this.connected) {
|
|
291
|
-
|
|
345
|
+
_context8.next = 25;
|
|
292
346
|
break;
|
|
293
347
|
}
|
|
294
|
-
|
|
295
|
-
|
|
348
|
+
_context8.prev = 2;
|
|
349
|
+
_context8.next = 5;
|
|
296
350
|
return this.client.createChannel();
|
|
297
351
|
case 5:
|
|
298
|
-
channel =
|
|
299
|
-
|
|
352
|
+
channel = _context8.sent;
|
|
353
|
+
_context8.next = 8;
|
|
300
354
|
return channel.assertQueue(prefixQueueName, {
|
|
301
355
|
durable: true
|
|
302
356
|
});
|
|
303
357
|
case 8:
|
|
304
|
-
return
|
|
358
|
+
return _context8.abrupt("return", _context8.sent);
|
|
305
359
|
case 11:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return
|
|
360
|
+
_context8.prev = 11;
|
|
361
|
+
_context8.t0 = _context8["catch"](2);
|
|
362
|
+
return _context8.abrupt("return", this.getInfo(queueName));
|
|
309
363
|
case 14:
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
364
|
+
_context8.prev = 14;
|
|
365
|
+
_context8.prev = 15;
|
|
366
|
+
_context8.next = 18;
|
|
313
367
|
return channel.close();
|
|
314
368
|
case 18:
|
|
315
|
-
|
|
369
|
+
_context8.next = 22;
|
|
316
370
|
break;
|
|
317
371
|
case 20:
|
|
318
|
-
|
|
319
|
-
|
|
372
|
+
_context8.prev = 20;
|
|
373
|
+
_context8.t1 = _context8["catch"](15);
|
|
320
374
|
case 22:
|
|
321
|
-
return
|
|
375
|
+
return _context8.finish(14);
|
|
322
376
|
case 23:
|
|
323
|
-
|
|
377
|
+
_context8.next = 26;
|
|
324
378
|
break;
|
|
325
379
|
case 25:
|
|
326
|
-
return
|
|
380
|
+
return _context8.abrupt("return", this.getInfo(queueName));
|
|
327
381
|
case 26:
|
|
328
382
|
case "end":
|
|
329
|
-
return
|
|
383
|
+
return _context8.stop();
|
|
330
384
|
}
|
|
331
385
|
}
|
|
332
|
-
},
|
|
386
|
+
}, _callee8, this, [[2, 11, 14, 23], [15, 20]]);
|
|
333
387
|
}));
|
|
334
|
-
function getInfo(
|
|
388
|
+
function getInfo(_x5) {
|
|
335
389
|
return _getInfo.apply(this, arguments);
|
|
336
390
|
}
|
|
337
391
|
return getInfo;
|
|
@@ -339,57 +393,57 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
339
393
|
}, {
|
|
340
394
|
key: "consume",
|
|
341
395
|
value: function () {
|
|
342
|
-
var _consume = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
396
|
+
var _consume = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(queueName, cb) {
|
|
343
397
|
var callbackError,
|
|
344
398
|
prefixQueueName,
|
|
345
399
|
channel,
|
|
346
400
|
messageQueue,
|
|
347
|
-
|
|
348
|
-
return _regeneratorRuntime().wrap(function
|
|
401
|
+
_args10 = arguments;
|
|
402
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
349
403
|
while (1) {
|
|
350
|
-
switch (
|
|
404
|
+
switch (_context10.prev = _context10.next) {
|
|
351
405
|
case 0:
|
|
352
|
-
callbackError =
|
|
406
|
+
callbackError = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : null;
|
|
353
407
|
prefixQueueName = this.parsePrefix(queueName);
|
|
354
408
|
if (!this.connected) {
|
|
355
|
-
|
|
409
|
+
_context10.next = 30;
|
|
356
410
|
break;
|
|
357
411
|
}
|
|
358
|
-
|
|
359
|
-
|
|
412
|
+
_context10.prev = 3;
|
|
413
|
+
_context10.next = 6;
|
|
360
414
|
return this.client.createChannel();
|
|
361
415
|
case 6:
|
|
362
|
-
channel =
|
|
363
|
-
|
|
416
|
+
channel = _context10.sent;
|
|
417
|
+
_context10.next = 9;
|
|
364
418
|
return channel.assertQueue(prefixQueueName, {
|
|
365
419
|
durable: true
|
|
366
420
|
});
|
|
367
421
|
case 9:
|
|
368
|
-
|
|
422
|
+
_context10.next = 11;
|
|
369
423
|
return channel.prefetch(1);
|
|
370
424
|
case 11:
|
|
371
425
|
messageQueue = this;
|
|
372
|
-
|
|
426
|
+
_context10.next = 14;
|
|
373
427
|
return new Promise(function (resolve, reject) {
|
|
374
428
|
channel.consume(prefixQueueName, /*#__PURE__*/function () {
|
|
375
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
429
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(msg) {
|
|
376
430
|
var data, errString;
|
|
377
|
-
return _regeneratorRuntime().wrap(function
|
|
431
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
378
432
|
while (1) {
|
|
379
|
-
switch (
|
|
433
|
+
switch (_context9.prev = _context9.next) {
|
|
380
434
|
case 0:
|
|
381
435
|
if (!msg) {
|
|
382
|
-
|
|
436
|
+
_context9.next = 55;
|
|
383
437
|
break;
|
|
384
438
|
}
|
|
385
439
|
data = JSON.parse(msg.content.toString());
|
|
386
440
|
if (!data) {
|
|
387
|
-
|
|
441
|
+
_context9.next = 52;
|
|
388
442
|
break;
|
|
389
443
|
}
|
|
390
|
-
|
|
444
|
+
_context9.prev = 3;
|
|
391
445
|
if (!msg.fields.redelivered) {
|
|
392
|
-
|
|
446
|
+
_context9.next = 23;
|
|
393
447
|
break;
|
|
394
448
|
}
|
|
395
449
|
if (!data.retry) {
|
|
@@ -397,143 +451,143 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
397
451
|
}
|
|
398
452
|
data.retry += 1;
|
|
399
453
|
if (!(data.retry < 5)) {
|
|
400
|
-
|
|
454
|
+
_context9.next = 17;
|
|
401
455
|
break;
|
|
402
456
|
}
|
|
403
457
|
if (!(messageQueue.worker && !queueName.startsWith(messageQueue.serverIp))) {
|
|
404
|
-
|
|
458
|
+
_context9.next = 13;
|
|
405
459
|
break;
|
|
406
460
|
}
|
|
407
|
-
|
|
461
|
+
_context9.next = 11;
|
|
408
462
|
return messageQueue.send("".concat(messageQueue.serverIp, "_").concat(queueName), data);
|
|
409
463
|
case 11:
|
|
410
|
-
|
|
464
|
+
_context9.next = 15;
|
|
411
465
|
break;
|
|
412
466
|
case 13:
|
|
413
|
-
|
|
467
|
+
_context9.next = 15;
|
|
414
468
|
return messageQueue.send(queueName, data);
|
|
415
469
|
case 15:
|
|
416
|
-
|
|
470
|
+
_context9.next = 19;
|
|
417
471
|
break;
|
|
418
472
|
case 17:
|
|
419
|
-
|
|
473
|
+
_context9.next = 19;
|
|
420
474
|
return messageQueue.send(messageQueue.parsePrefix('RETRY'), {
|
|
421
475
|
queueName: queueName,
|
|
422
476
|
data: data,
|
|
423
477
|
retry_time: new Date()
|
|
424
478
|
});
|
|
425
479
|
case 19:
|
|
426
|
-
|
|
480
|
+
_context9.next = 21;
|
|
427
481
|
return channel.ack(msg);
|
|
428
482
|
case 21:
|
|
429
|
-
|
|
483
|
+
_context9.next = 45;
|
|
430
484
|
break;
|
|
431
485
|
case 23:
|
|
432
|
-
|
|
433
|
-
|
|
486
|
+
_context9.prev = 23;
|
|
487
|
+
_context9.next = 26;
|
|
434
488
|
return cb(data);
|
|
435
489
|
case 26:
|
|
436
|
-
|
|
490
|
+
_context9.next = 28;
|
|
437
491
|
return channel.ack(msg);
|
|
438
492
|
case 28:
|
|
439
|
-
|
|
493
|
+
_context9.next = 45;
|
|
440
494
|
break;
|
|
441
495
|
case 30:
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
errString =
|
|
496
|
+
_context9.prev = 30;
|
|
497
|
+
_context9.t0 = _context9["catch"](23);
|
|
498
|
+
errString = _context9.t0.toString();
|
|
445
499
|
if (!_lodash["default"].some(['IllegalOperationError: Channel closed'], function (el) {
|
|
446
500
|
return _lodash["default"].includes(errString, el);
|
|
447
501
|
})) {
|
|
448
|
-
|
|
502
|
+
_context9.next = 37;
|
|
449
503
|
break;
|
|
450
504
|
}
|
|
451
505
|
reject(new Error(errString));
|
|
452
|
-
|
|
506
|
+
_context9.next = 45;
|
|
453
507
|
break;
|
|
454
508
|
case 37:
|
|
455
509
|
if (callbackError) {
|
|
456
|
-
callbackError(prefixQueueName,
|
|
510
|
+
callbackError(prefixQueueName, _context9.t0);
|
|
457
511
|
}
|
|
458
512
|
if (!data.noRetry) {
|
|
459
|
-
|
|
513
|
+
_context9.next = 43;
|
|
460
514
|
break;
|
|
461
515
|
}
|
|
462
|
-
|
|
516
|
+
_context9.next = 41;
|
|
463
517
|
return channel.ack(msg);
|
|
464
518
|
case 41:
|
|
465
|
-
|
|
519
|
+
_context9.next = 45;
|
|
466
520
|
break;
|
|
467
521
|
case 43:
|
|
468
|
-
|
|
522
|
+
_context9.next = 45;
|
|
469
523
|
return channel.nack(msg);
|
|
470
524
|
case 45:
|
|
471
|
-
|
|
525
|
+
_context9.next = 50;
|
|
472
526
|
break;
|
|
473
527
|
case 47:
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
reject(
|
|
528
|
+
_context9.prev = 47;
|
|
529
|
+
_context9.t1 = _context9["catch"](3);
|
|
530
|
+
reject(_context9.t1);
|
|
477
531
|
case 50:
|
|
478
|
-
|
|
532
|
+
_context9.next = 53;
|
|
479
533
|
break;
|
|
480
534
|
case 52:
|
|
481
535
|
channel.ack(msg);
|
|
482
536
|
case 53:
|
|
483
|
-
|
|
537
|
+
_context9.next = 56;
|
|
484
538
|
break;
|
|
485
539
|
case 55:
|
|
486
540
|
reject(new Error('msg null'));
|
|
487
541
|
case 56:
|
|
488
542
|
case "end":
|
|
489
|
-
return
|
|
543
|
+
return _context9.stop();
|
|
490
544
|
}
|
|
491
545
|
}
|
|
492
|
-
},
|
|
546
|
+
}, _callee9, null, [[3, 47], [23, 30]]);
|
|
493
547
|
}));
|
|
494
|
-
return function (
|
|
548
|
+
return function (_x8) {
|
|
495
549
|
return _ref.apply(this, arguments);
|
|
496
550
|
};
|
|
497
551
|
}());
|
|
498
552
|
});
|
|
499
553
|
case 14:
|
|
500
|
-
|
|
554
|
+
_context10.next = 28;
|
|
501
555
|
break;
|
|
502
556
|
case 16:
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
557
|
+
_context10.prev = 16;
|
|
558
|
+
_context10.t0 = _context10["catch"](3);
|
|
559
|
+
_context10.prev = 18;
|
|
560
|
+
_context10.next = 21;
|
|
507
561
|
return channel.close();
|
|
508
562
|
case 21:
|
|
509
|
-
|
|
563
|
+
_context10.next = 25;
|
|
510
564
|
break;
|
|
511
565
|
case 23:
|
|
512
|
-
|
|
513
|
-
|
|
566
|
+
_context10.prev = 23;
|
|
567
|
+
_context10.t1 = _context10["catch"](18);
|
|
514
568
|
case 25:
|
|
515
|
-
|
|
569
|
+
_context10.next = 27;
|
|
516
570
|
return (0, _util.timeout)(5000);
|
|
517
571
|
case 27:
|
|
518
|
-
return
|
|
572
|
+
return _context10.abrupt("return", this.consume(queueName, cb, callbackError));
|
|
519
573
|
case 28:
|
|
520
|
-
|
|
574
|
+
_context10.next = 33;
|
|
521
575
|
break;
|
|
522
576
|
case 30:
|
|
523
|
-
|
|
577
|
+
_context10.next = 32;
|
|
524
578
|
return (0, _util.timeout)(5000);
|
|
525
579
|
case 32:
|
|
526
|
-
return
|
|
580
|
+
return _context10.abrupt("return", this.consume(queueName, cb, callbackError));
|
|
527
581
|
case 33:
|
|
528
|
-
return
|
|
582
|
+
return _context10.abrupt("return", true);
|
|
529
583
|
case 34:
|
|
530
584
|
case "end":
|
|
531
|
-
return
|
|
585
|
+
return _context10.stop();
|
|
532
586
|
}
|
|
533
587
|
}
|
|
534
|
-
},
|
|
588
|
+
}, _callee10, this, [[3, 16], [18, 23]]);
|
|
535
589
|
}));
|
|
536
|
-
function consume(
|
|
590
|
+
function consume(_x6, _x7) {
|
|
537
591
|
return _consume.apply(this, arguments);
|
|
538
592
|
}
|
|
539
593
|
return consume;
|
|
@@ -541,20 +595,20 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
541
595
|
}, {
|
|
542
596
|
key: "selfReceiving",
|
|
543
597
|
value: function () {
|
|
544
|
-
var _selfReceiving = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
545
|
-
return _regeneratorRuntime().wrap(function
|
|
598
|
+
var _selfReceiving = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(queueName, cb, callbackError) {
|
|
599
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
546
600
|
while (1) {
|
|
547
|
-
switch (
|
|
601
|
+
switch (_context11.prev = _context11.next) {
|
|
548
602
|
case 0:
|
|
549
603
|
this.consume("".concat(this.serverIp, "_").concat(queueName), cb, callbackError);
|
|
550
604
|
case 1:
|
|
551
605
|
case "end":
|
|
552
|
-
return
|
|
606
|
+
return _context11.stop();
|
|
553
607
|
}
|
|
554
608
|
}
|
|
555
|
-
},
|
|
609
|
+
}, _callee11, this);
|
|
556
610
|
}));
|
|
557
|
-
function selfReceiving(
|
|
611
|
+
function selfReceiving(_x9, _x10, _x11) {
|
|
558
612
|
return _selfReceiving.apply(this, arguments);
|
|
559
613
|
}
|
|
560
614
|
return selfReceiving;
|
|
@@ -562,26 +616,26 @@ var RabbitMQAsync = /*#__PURE__*/function () {
|
|
|
562
616
|
}, {
|
|
563
617
|
key: "receiving",
|
|
564
618
|
value: function () {
|
|
565
|
-
var _receiving = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
619
|
+
var _receiving = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(queueName, cb) {
|
|
566
620
|
var callbackError,
|
|
567
|
-
|
|
568
|
-
return _regeneratorRuntime().wrap(function
|
|
621
|
+
_args12 = arguments;
|
|
622
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
569
623
|
while (1) {
|
|
570
|
-
switch (
|
|
624
|
+
switch (_context12.prev = _context12.next) {
|
|
571
625
|
case 0:
|
|
572
|
-
callbackError =
|
|
626
|
+
callbackError = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : null;
|
|
573
627
|
this.consume(queueName, cb, callbackError);
|
|
574
628
|
if (this.worker) {
|
|
575
629
|
this.selfReceiving(queueName, cb, callbackError);
|
|
576
630
|
}
|
|
577
631
|
case 3:
|
|
578
632
|
case "end":
|
|
579
|
-
return
|
|
633
|
+
return _context12.stop();
|
|
580
634
|
}
|
|
581
635
|
}
|
|
582
|
-
},
|
|
636
|
+
}, _callee12, this);
|
|
583
637
|
}));
|
|
584
|
-
function receiving(
|
|
638
|
+
function receiving(_x12, _x13) {
|
|
585
639
|
return _receiving.apply(this, arguments);
|
|
586
640
|
}
|
|
587
641
|
return receiving;
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azteam/rabbitmq-async",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.166",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "./lib/index.js",
|
|
6
|
-
"module": "./src/index.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "babel src --delete-dir-on-start -d lib"
|
|
9
|
-
},
|
|
10
5
|
"keywords": [
|
|
11
6
|
"toda",
|
|
12
7
|
"nodejs",
|
|
13
8
|
"rabbitmq",
|
|
14
9
|
"rabbitmq async"
|
|
15
10
|
],
|
|
16
|
-
"author": "toda <sp.azsolution.net@gmail.com>",
|
|
17
11
|
"license": "MIT",
|
|
12
|
+
"author": "toda <sp.azsolution.net@gmail.com>",
|
|
13
|
+
"main": "./lib/index.js",
|
|
14
|
+
"module": "./src/index.js",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "babel src --delete-dir-on-start -d lib"
|
|
17
|
+
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@azteam/util": "1.0.29",
|
|
20
20
|
"amqplib": "0.8.0",
|
package/src/RabbitMQAsync.js
CHANGED
|
@@ -104,10 +104,18 @@ class RabbitMQAsync {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
async selfSend(queueName, msg = {}, limit = 0) {
|
|
108
|
+
this.send(`${this.serverIp}_${queueName}`, msg, limit);
|
|
109
|
+
}
|
|
110
|
+
|
|
107
111
|
async sendNoRetry(queueName, msg = {}, limit = 0) {
|
|
108
112
|
this.send(queueName, {...msg, noRetry: true}, limit);
|
|
109
113
|
}
|
|
110
114
|
|
|
115
|
+
async selfSendNoRetry(queueName, msg = {}, limit = 0) {
|
|
116
|
+
this.selfSend(queueName, {...msg, noRetry: true}, limit);
|
|
117
|
+
}
|
|
118
|
+
|
|
111
119
|
async getInfo(queueName) {
|
|
112
120
|
const prefixQueueName = this.parsePrefix(queueName);
|
|
113
121
|
|