@axah/mq
Advanced tools
Comparing version 0.0.0-20230913113112 to 0.0.0-20230913115535
@@ -71,7 +71,16 @@ "use strict"; | ||
else { | ||
log.error({ err, content }, `Error while reading message from ${subscriptionName}. Error "${err.message}" occurred while processing message. Will nack message and send to dead letter queue`); | ||
const errorMessage = `Error while reading message from ${subscriptionName}. Error "${err.message}" occurred while processing message.`; | ||
if (subscription.recovery) { | ||
const currentAttempts = message.properties.headers.rascal?.[subscription.queue ?? '']?.republished ?? | ||
subscription.recovery.attempts; | ||
if (currentAttempts === subscription.recovery.attempts) { | ||
log.error({ err, content }, `${errorMessage} Will nack message and send to dead letter queue`); | ||
} | ||
else { | ||
log.warn({ err, content }, `${errorMessage} Will try to recover message with attempt: ${currentAttempts}`); | ||
} | ||
ackOrNack(err, [subscription.recovery, { strategy: 'nack' }]); | ||
} | ||
else { | ||
log.error({ err, content }, `${errorMessage} Will nack message and send to dead letter queue`); | ||
ackOrNack(err, { strategy: 'nack' }); | ||
@@ -78,0 +87,0 @@ } |
{ | ||
"name": "@axah/mq", | ||
"version": "0.0.0-20230913113112", | ||
"version": "0.0.0-20230913115535", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
41102
466