1

I have the following code . My node version is v0.7.0-pre . When I run the code the screen prints

 Setup
 Completed setup

It does not print the Exchange Callback message . When I run the

rabbitmqctl --list_exchanges  

command I see the new exchange getting created but the callback is not getting called . I looked at the test cases and this does not seem to be a covered case . Let me know if this is a bug and if there is a work around

var util= require('util')
var amqp = require('amqp');

function setup() {
  console.log("Setup");
  var exchange = conn.exchange('cf1-demo',
    {'type': 'fanout', durable: false},
    function() {
    console.log("Exchange Callback");
 });
 console.log("Completed setup %s", exchange.name);
}
var conn = amqp.createConnection({host:'localhost',
                                    login:'guest',
                                    password:'guest'},
                             {defaultExchangeName: "cf1-demo"});
conn.on('ready',setup);
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
  • I would love to answer this question but unfortunately the code you've given me runs fine on my machine, giving this output: `Setup Completed setup cf1-demo Exchange Callback` – mattbornski Jan 31 '12 at 18:49
  • Your code is okay, as @mattbornski mentioned. It could be some caveats regarding node's version — maybe plugin doesn't support newest unstable version due to api changes or something. It definitely works with node 0.6.8 and amqp 0.1.1. – Aleksei Zabrodskii Jan 31 '12 at 20:51
  • I am running Ubuntu 11.04 x86_64 . When I run a rabbitmqctl report I see rabbitMQ version as 2.7.1 . I changed my node to nodev0.6.8 and I still get the same behavior . I am not sure how to find the version of amqp – Harihara Vinayakaram Feb 01 '12 at 08:26
  • You'll see amqp version in `npm ls` output or module-related `package.json` file. By the way, my RabbitMQ version is 2.7.1. Code was tested in Ubuntu x86_64: both 10.10 and 11.10. – Aleksei Zabrodskii Feb 01 '12 at 14:18
  • Thanks my amqp version says 0.0.2 . Let me get the latest version and update the results . I thought I did npm install amqp . Is there a different way to do it ? – Harihara Vinayakaram Feb 01 '12 at 17:12
  • Thanks I was able to upgrade to the latest version on node-amqp and things worked . I had to a git clone install of npm install – Harihara Vinayakaram Feb 02 '12 at 03:43

1 Answers1

0

This was a problem with node-amqp being the old version . This seemed to be a problem with npm install as far as I can figure