diff --git a/package.json b/package.json index b307242..a1887cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "carotte-amqp", - "version": "1.2.2", + "version": "1.2.3", "description": "AMQP wrapper for the carotte microservice framework", "main": "src/index.js", "repository": "https://github.com/cubyn/node-carotte-amqp", diff --git a/src/describe.js b/src/describe.js index a225ef1..4f139e5 100644 --- a/src/describe.js +++ b/src/describe.js @@ -1,7 +1,12 @@ const replaceNonDirect = /^(topic|fanout)\//; module.exports.subscribeToDescribe = function (carotte, qualifier, meta) { - qualifier = qualifier.replace(replaceNonDirect, 'direct/'); + if (replaceNonDirect.test(qualifier)) { + qualifier = qualifier.replace(replaceNonDirect, 'direct/'); + const parts = qualifier.split('/'); + qualifier = `${parts[0]}/${parts[parts.length - 1]}`; + } + carotte.subscribe(`${qualifier}:describe`, { queue: { durable: false, autoDelete: true } }, () => { return meta; }); diff --git a/src/index.js b/src/index.js index f9b684d..4482733 100644 --- a/src/index.js +++ b/src/index.js @@ -239,7 +239,7 @@ function Carotte(config) { return ok.then(() => { producerDebug(`publishing to ${options.routingKey} on ${exchangeName}`); if (log) { - config.transport.info(`${rpc ? '>> ' : '> '} ${options.type}/${options.routingKey}`, { + config.transport.info(`${rpc ? '▶ ' : '▷ '} ${options.type}/${options.routingKey}`, { context: options.context, headers: options.headers, data: payload, @@ -261,7 +261,7 @@ function Carotte(config) { }); }) .catch(err => { - config.transport.error(`${rpc ? '>> ' : '> '} ${options.type}/${options.routingKey}`, { + config.transport.error(`${rpc ? '▶ ' : '▷ '} ${options.type}/${options.routingKey}`, { context: options.context, headers: options.headers, data: payload, @@ -459,7 +459,7 @@ function Carotte(config) { consumerDebug('Handler success'); // otherwise internal subscribe (rpc…) if (qualifier) { - config.transport.info(`${rpc ? '<< ' : '< '} ${qualifier}`, { + config.transport.info(`${rpc ? '◀ ' : '◁ '} ${qualifier}`, { context, headers, data, @@ -499,7 +499,7 @@ function Carotte(config) { const pubOptions = messageToOptions(qualifier, message); const rpc = headers['x-reply-to'] !== undefined; - config.transport.error(`${rpc ? '<< ' : '< '} ${qualifier}`, { + config.transport.error(`${rpc ? '◀ ' : '◁ '} ${qualifier}`, { context, headers, subscriber: qualifier,