amqplib-easy
Advanced tools
Comparing version 4.3.0 to 4.3.1
12
index.js
@@ -104,9 +104,9 @@ 'use strict' | ||
.then(function () { | ||
if ((options.topics && options.topics.length) || (options.exchangeType === 'x-delayed-message' && options.exchangeOptions.arguments['x-delayed-type'] === 'topic')) { | ||
return Promise.map(options.topics, function (topic) { | ||
return ch.bindQueue(options.queue, options.exchange, topic, options.arguments) | ||
}) | ||
} else if (options.exchangeType === 'fanout' || (options.exchangeType === 'x-delayed-message' && options.exchangeOptions.arguments['x-delayed-type'] === 'fanout')) { | ||
return ch.bindQueue(options.queue, options.exchange, '', options.arguments) | ||
if (!options.topics || !options.topics.length) { | ||
options.topics = [''] | ||
} | ||
return Promise.map(options.topics, function (topic) { | ||
return ch.bindQueue(options.queue, options.exchange, topic, options.arguments || {}) | ||
}) | ||
}) | ||
@@ -113,0 +113,0 @@ .then(function () { |
{ | ||
"name": "amqplib-easy", | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"description": "Simplified API for interacting with AMQP", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
/*globals it:false*/ | ||
/* globals it:false */ | ||
'use strict' | ||
@@ -202,2 +202,55 @@ | ||
}) | ||
describe('headers exchange', function () { | ||
function deleteCat () { | ||
return amqp.connect() | ||
.then(function (connection) { | ||
return connection.createChannel() | ||
.then(function (channel) { | ||
return channel.checkExchange('cat') | ||
.then( | ||
function () { | ||
return channel.deleteExchange('cat') | ||
}, | ||
function () { /* NBD it doesn't exist */ | ||
} | ||
) | ||
}) | ||
}) | ||
} | ||
afterEach(deleteCat) | ||
it('should publish via headers', function (done) { | ||
amqp.consume( | ||
{ | ||
exchange: 'cat', | ||
exchangeType: 'headers', | ||
arguments: { | ||
'color': 'blue' | ||
}, | ||
queue: 'found_cats' | ||
}, | ||
function (cat) { | ||
var name = cat.json.name | ||
try { | ||
name.should.equal('Sally') | ||
done() | ||
} catch (err) { | ||
done(err) | ||
} | ||
} | ||
) | ||
.then(function (c) { | ||
cancel = c | ||
return amqp.publish( | ||
{exchange: 'cat', exchangeType: 'headers'}, | ||
'found.tawny', | ||
{name: 'Sally'}, | ||
{headers: {color: 'blue'}} | ||
) | ||
}) | ||
.catch(done) | ||
}) | ||
}) | ||
}) | ||
@@ -204,0 +257,0 @@ |
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
26661
605