0

I'm using node-amqp library for my nodejs project. I also posted the issue to it's github project page.

It keeps creating new channels and they stay idle forever. After an hour channels were ~12000. I checked the options for exchange and publish but so far I'm not even close to solution.

What's wrong with the code and/or is there any options/settings for rabbitmq server for the issue?

Here is the sample code:

connection.exchange("brcks-wfa",{type:'direct',durable:true}, function(exchange) {   
setInterval(function() {
        ...
        awS.forEach(function(wc){
                    ...
                    nstbs.forEach(function(br){
                        ...
                        BUpdate(brnewinfo,function(st){
                            if(st){
                                exchange.publish(route, brnewinfo,{contentType:"application/json"});
                            }
                        });
                    });
                    ...
        });
}, 4000);
});
hayzem
  • 67
  • 1
  • 8
  • Is the above code called only once in your project? Or could the above be called more than once? – lsowen Mar 07 '15 at 22:39
  • This is a child process of another parent script. So when trigger event comes through RabbitMQ this parent script restart this child process. And When this child process exit, it closes the connections. I can update the question with this parent script, if it's necessary. – hayzem Mar 08 '15 at 13:08
  • In the code snippet you have above, it looks like everything is right. I have two follow up questions: (1) What version of node-amqp are you using? (2) Would you post the code responsible for closing the connections? – lsowen Mar 09 '15 at 00:31
  • Note that we the RabbitMQ team do not recommend that library. If possible use this one instead: https://github.com/squaremo/amqp.node/ – old_sound Mar 09 '15 at 23:50

1 Answers1

0

There is a bug in node-amqp where channels are not closed. The rabbit MQ team no longer recommends using this library anymore, instead they are recommending ampq.node which is a bit more low-level and lets/requires you to handle channels manually.

Anders Bornholm
  • 1,326
  • 7
  • 18