diff --git a/package-lock.json b/package-lock.json index 43c5c9c..7f4037d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "3.3.3", "license": "MIT", "dependencies": { - "@types/amqplib": "^0.10.1", - "amqp-connection-manager": "^4.1.13", + "@types/amqplib": "^0.10.5", + "amqp-connection-manager": "^4.1.14", "amqplib": "^0.10.3" }, "devDependencies": { @@ -149,9 +149,9 @@ } }, "node_modules/@types/amqplib": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@types/amqplib/-/amqplib-0.10.1.tgz", - "integrity": "sha512-j6ANKT79ncUDnAs/+9r9eDujxbeJoTjoVu33gHHcaPfmLQaMhvfbH2GqSe8KUM444epAp1Vl3peVOQfZk3UIqA==", + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/@types/amqplib/-/amqplib-0.10.5.tgz", + "integrity": "sha512-/cSykxROY7BWwDoi4Y4/jLAuZTshZxd8Ey1QYa/VaXriMotBDoou7V/twJiOSHzU6t1Kp1AHAUXGCgqq+6DNeg==", "dependencies": { "@types/node": "*" } @@ -205,9 +205,9 @@ } }, "node_modules/amqp-connection-manager": { - "version": "4.1.13", - "resolved": "https://registry.npmjs.org/amqp-connection-manager/-/amqp-connection-manager-4.1.13.tgz", - "integrity": "sha512-riL5EOlXDlBY4VTTfi6lgy4lwrDbtncQQ9C4SdgxGV6PZ8vgBsNmiKnkxGLvbppDRZ70522glxIc1ep+9Xd/Xw==", + "version": "4.1.14", + "resolved": "https://registry.npmjs.org/amqp-connection-manager/-/amqp-connection-manager-4.1.14.tgz", + "integrity": "sha512-1km47dIvEr0HhMUazqovSvNwIlSvDX2APdUpULaINtHpiki1O+cLRaTeXb/jav4OLtH+k6GBXx5gsKOT9kcGKQ==", "dependencies": { "promise-breaker": "^6.0.0" }, diff --git a/package.json b/package.json index 5cf05d1..a71d838 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-message-bus", - "version": "3.3.3", + "version": "3.3.4", "description": "Minimalistic and complete AMQP message bus implementation", "main": "lib/index.js", "files": [ @@ -53,8 +53,8 @@ "typescript": "^5.0.4" }, "dependencies": { - "@types/amqplib": "^0.10.1", - "amqp-connection-manager": "^4.1.13", + "@types/amqplib": "^0.10.5", + "amqp-connection-manager": "^4.1.14", "amqplib": "^0.10.3" } } diff --git a/src/consumer.ts b/src/consumer.ts index 5b7f488..a508f20 100644 --- a/src/consumer.ts +++ b/src/consumer.ts @@ -39,7 +39,7 @@ const backoffRetryMessage = async ({ error?: Error; }) => { const currentBackoffSeconds = - parseInt(message.properties.headers[HEADER_NAME_EXP_BACKOFF_SEC]) || 0; + parseInt(message.properties.headers?.[HEADER_NAME_EXP_BACKOFF_SEC]) || 0; const nextBackoffSeconds = Math.min( MAX_EXP_BACKOFF, currentBackoffSeconds @@ -156,8 +156,8 @@ export async function consumeMessages( } if ( - message.properties.headers[HEADER_NAME_TARGET_QUEUE] && - message.properties.headers[HEADER_NAME_TARGET_QUEUE] !== queueName + message.properties.headers?.[HEADER_NAME_TARGET_QUEUE] && + message.properties.headers?.[HEADER_NAME_TARGET_QUEUE] !== queueName ) { log( `Skipping message "${message.fields.routingKey}" in queue "${queueName}" because it is intended for queue "${message.properties.headers[HEADER_NAME_TARGET_QUEUE]}" due to backoff.`