amqp vs amqplib - which Node.js amqp client library is better?

后端 未结 7 1316
灰色年华
灰色年华 2021-01-30 04:17

What are the differences between those amqp client libraries? Which one is the most recommended? What are the major differences?

7条回答
  •  渐次进展
    2021-01-30 04:43

    I used both for a while. At the first glance, it might seem that node-amqp (amqp) is more adequate but it actually has so many bugs and no one is fixing them. For instances,

    1. RabbitMQ's MQTT and STOMP adapter should allow communication between clients using those 2 protocols with clients using AMQP, but node-amqp just fails to parse messages sent by MQTT or STOMP, while amqp.node (amqplib) can.
    2. node-amqp (amqp) has implemented auto-reconnecting and so doesn't throw exceptions on accidental disconnection. That means you will be forced to use the built-in reconnecting, you can't detect disconnection and handle it yourself. However, its reconnecting always double the number of connections. It will exhaust both client and server eventually. I'd rather code my own reconnecting function with amqp.node (amqplib).

    I tested it with broker provided by www.robomq.io, it's a good one so the blame should be of the library. Implementing a perfect library in Node.js is tough though.

    By the way, you can find a full set of example code using amqp.node (amqplib) in 5 scenarios at https://github.com/robomq/robomq.io/tree/master/sdk/AMQP/Node.js and the documentation at http://robomq.readthedocs.org/en/latest/one-one/#nodejs.

提交回复
热议问题