postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

queue.bind() throws an error #160

Open esidorov opened 11 years ago

esidorov commented 11 years ago
self.queue = self.connection.queue(routingKey, {passive: false, durable: true, autoDelete: false}, function(queue){
self.queue.bind(exchange, "*");
});

Creates new queue and binds it to the exchange, but then throws an error: /usr/lib/node_modules/amqp/amqp.js:1914 if (this.consumerTagOptions[consumerTags[index]]['state'] === 'closed' ^ TypeError: Cannot read property 'state' of undefined at Queue._onMethod (/usr/lib/node_modules/amqp/amqp.js:1914:57) at Queue.Channel._onChannelMethod (/usr/lib/node_modules/amqp/amqp.js:1533:14) at Connection._onMethod (/usr/lib/node_modules/amqp/amqp.js:1056:28) at AMQPParser.self.addListener.parser.onMethod (/usr/lib/node_modules/amqp/amqp.js:895:12) at AMQPParser._parseMethodFrame (/usr/lib/node_modules/amqp/amqp.js:449:10) at frameEnd (/usr/lib/node_modules/amqp/amqp.js:190:16) at frame (/usr/lib/node_modules/amqp/amqp.js:175:14) at AMQPParser.header as parse at AMQPParser.execute (/usr/lib/node_modules/amqp/amqp.js:234:21) at Connection. (/usr/lib/node_modules/amqp/amqp.js:932:12)

barshow commented 11 years ago

try this

self.queue = self.connection.queue(routingKey, {passive: false, durable: true, autoDelete: false}, function(queue){ 
  queue.bind(exchange, "*");
});
esidorov commented 11 years ago

Thanks, but, nope,

self.queue = self.connection.queue("Test", null, function(q){
console.log(q.name)
});

Code above crates a gueue 'Test', prints it's name, but throws an error mentioned in my original post.

FGRibreau commented 11 years ago

Same issue here

FGRibreau commented 11 years ago

Its a regression, the same code works well with amqp@0.1.3.