Comparing version 0.1.15 to 0.2.0
@@ -80,3 +80,3 @@ "use strict"; | ||
* @param {Object|Function} [options] | ||
* @param {Function} [handler] | ||
* @param {Function} [handler] function (err, message) | ||
* @returns {Promise} | ||
@@ -95,8 +95,9 @@ */ | ||
message.payload = codec.decode(message.content); | ||
return handler(message); | ||
}).done(function () { | ||
return handler(null, message); | ||
}).then(function () { | ||
return message.ack(); | ||
}, function (err) { | ||
}).catch(function (err) { | ||
debug('error', 'Error thrown in routing handler, not acking message. Error: ', err.stack); | ||
that.emit('error', err); | ||
handler(err, message); | ||
}); | ||
@@ -103,0 +104,0 @@ }); |
{ | ||
"name": "amqper", | ||
"version": "0.1.15", | ||
"version": "0.2.0", | ||
"description": "A simple and elegant AMQP client for node based on amqplib.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/taoyuan/amqper", |
@@ -34,3 +34,3 @@ 'use strict'; | ||
client.$promise.then(function () { | ||
client.route('test1.:arg', {queue: 'this_is_queue_name_1'}, function (message) { | ||
client.route('test1.:arg', {queue: 'this_is_queue_name_1'}, function (err, message) { | ||
t.deepEqual(message.payload, data); | ||
@@ -54,3 +54,3 @@ delayCloseClient(client, done); | ||
client.format('msgpack'); | ||
client.route('test2.:arg', {queue: 'this_is_queue_name_2'}, function (message) { | ||
client.route('test2.:arg', {queue: 'this_is_queue_name_2'}, function (err, message) { | ||
t.deepEqual(message.payload, data); | ||
@@ -57,0 +57,0 @@ delayCloseClient(client, done); |
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
19946
507