Skip to content

Commit

Permalink
Merge branch 'release/1.2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
getvega committed May 29, 2017
2 parents 0895fb5 + 5935309 commit 9c7a164
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "carotte-amqp",
"version": "1.2.4",
"version": "1.2.5",
"description": "AMQP wrapper for the carotte microservice framework",
"main": "src/index.js",
"repository": "https://github.com/cubyn/node-carotte-amqp",
Expand Down
14 changes: 10 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ function Carotte(config) {
}

options = Object.assign({ headers: {}, context: {} }, options, parseQualifier(qualifier));
options.headers['x-destination'] = qualifier;

if (!config.enableDeadLetter || config.deadLetterQualifier !== qualifier) {
options.headers['x-destination'] = qualifier;
}

const exchangeName = getExchangeName(options);
const rpc = options.headers['x-reply-to'] !== undefined;
Expand Down Expand Up @@ -462,20 +465,23 @@ function Carotte(config) {
publish: subPublication(context, 'publish').bind(this),
parallel: subPublication(context, 'parallel').bind(this)
})
.then(res => {
.then(response => {
const timeNow = new Date().getTime();
autodocAgent.logStats(qualifier, timeNow - startTime, headers['x-origin-service']);
// send back response if needed
return carotte.replyToPublisher(message, res, context);
return carotte.replyToPublisher(message, response, context)
// forward response down the chain
.then(() => response);
})
.then(() => {
.then(response => {
consumerDebug('Handler success');
// otherwise internal subscribe (rpc…)
if (qualifier) {
config.transport.info(`${rpc ? '◀ ' : '◁ '} ${qualifier}`, {
context,
headers,
data,
response,
subscriber: qualifier,
destination: '',
executionMs: new Date().getTime() - startTime,
Expand Down

0 comments on commit 9c7a164

Please sign in to comment.