Good Node.js Example with proper exception handling using node.amqp

1,093 views
Skip to first unread message

Patrick Mclean

unread,
Jul 29, 2015, 4:26:09 PM7/29/15
to rabbitmq-users
Hi, all. I've been testing a RabbitMQ cluster with a node.js publisher using node.amqp. Here's what I am seeing. I set the publisher to send 20000 messages (1 every second). While the publisher is running I stop the master server. I am expecting to see the traffic move to the slave. It does not. Whats interesting is that the publisher continues to count out messages sent while the slave receives nothing. If I restart the publisher. It then publishes to the slave. I believe this has to do with the way I have structured my code. I have not seen a good example of a production ready node.js publisher that could recover from a cluster fail-over. Can anyone point me to a good example? If I can see a good example I could probably figure out why my client is not recovering from the failover as I expect. Also, these are load balanced and I am setting the reconnect options in the node.amqp connection. Any assistance is greatly appreciated!

Michael Klishin

unread,
Jul 29, 2015, 4:29:40 PM7/29/15
to rabbitmq-users, Patrick Mclean
On 29 Jul 2015 at 23:26:12, Patrick Mclean (pmcle...@gmail.com) wrote:
> Hi, all. I've been testing a RabbitMQ cluster with a node.js
> publisher using node.amqp.

Patrick,

I’m afraid the only piece of advice for node-amqp we’ve got is: avoid it like a plague.

It’s a terrible client with no shortage of known bugs and tendencies to cause connection storms.
It is also hasn’t been maintained for a long time and the original author has zero interest
in fixing its issues. Some hosted RabbitMQ providers block node-amqp connections outright — it’s
that bad. 

Use amqplib [1], which is sane, has a responsive and reasonable maintainer, and is taken
care of quite well. Oh, and it also has more examples than any other Node.js RabbitMQ client :)

1. https://github.com/squaremo/amqp.node/
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Michael Klishin

unread,
Jul 29, 2015, 8:16:27 PM7/29/15
to Patrick Mclean, rabbitm...@googlegroups.com
+rabbitmq-users

On 30 Jul 2015 at 02:19:32, Patrick Mclean (pmcle...@gmail.com) wrote:
> That explains soooo much. I'll refactor my code to amqplib and
> see if that fixes the issue.

FYI: https://github.com/squaremo/amqp.node/issues/163
Reply all
Reply to author
Forward
0 new messages