amqplib-easy
Advanced tools
Comparing version 2.3.0 to 3.0.0
28
index.js
@@ -74,2 +74,12 @@ 'use strict'; | ||
.then(function () { | ||
function parse(msg) { | ||
return function() { | ||
try { | ||
msg.json = JSON.parse(msg.content.toString()); | ||
return handler(msg, ch); | ||
} catch (err) { | ||
console.error('Error converting AMQP message content to JSON.', err); | ||
} | ||
}; | ||
} | ||
if (options.retry) { | ||
@@ -83,10 +93,3 @@ return ch.consume(options.queue, retry({ | ||
return BPromise.resolve() | ||
.then(function () { | ||
try { | ||
msg.json = JSON.parse(msg.content.toString()); | ||
} catch (err) { | ||
console.error('Error converting AMQP message content to JSON.', err); | ||
} | ||
return handler(msg, ch); | ||
}); | ||
.then(parse(msg)); | ||
} | ||
@@ -98,11 +101,4 @@ })); | ||
return BPromise.resolve() | ||
.then(parse(msg)) | ||
.then(function () { | ||
try { | ||
msg.json = JSON.parse(msg.content.toString()); | ||
} catch (err) { | ||
console.error('Error converting AMQP message content to JSON.', err); | ||
} | ||
return handler(msg, ch); | ||
}) | ||
.then(function () { | ||
return ch.ack(msg); | ||
@@ -109,0 +105,0 @@ }) |
{ | ||
"name": "amqplib-easy", | ||
"version": "2.3.0", | ||
"version": "3.0.0", | ||
"description": "Simplified API for interacting with AMQP", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17696
289