Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,24 @@ Queue.prototype.unbind = function (exchange, routingKey) {
});
};

Queue.prototype.bind_headers = function (/* [exchange,] matchingPairs */) {
Queue.prototype.bind_headers = function (/* [exchange,] matchingPairs [, routingKey] */) {
var self = this;

// The first argument, exchange is optional.
// If not supplied the connection will use the default 'amq.headers'
// exchange.
// The third argument, routingKey is optional. If not supplied routingKey is an empty string

var exchange, matchingPairs;
var exchange, routingKey, matchingPairs;

if (arguments.length == 2) {
if (arguments.length >= 2) {
exchange = arguments[0];
matchingPairs = arguments[1];
routingKey = arguments[2] || '';
} else {
exchange = 'amq.headers';
matchingPairs = arguments[0];
routingKey = arguments[1] || '';
}


Expand All @@ -331,7 +334,7 @@ Queue.prototype.bind_headers = function (/* [exchange,] matchingPairs */) {
{ reserved1: 0
, queue: self.name
, exchange: exchangeName
, routingKey: ''
, routingKey: routingKey
, noWait: false
, "arguments": matchingPairs
});
Expand Down