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

后端 未结 7 1200
灰色年华
灰色年华 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:33

    I would recommend amqp.node and bramqp over node-amqp. node-amqp has a lot of bugs and is poorly maintained, and it hides the "channel" concept which introduces a lot of problems for rabbitmq servers (because they are never closed).

    0 讨论(0)
  • 2021-01-30 04:40

    Just started learning rabbitmq myself. I've found from other blogs that ampq.node is well accepted. Another one that I've found (not tested) is from wascally. https://github.com/LeanKit-Labs/wascally

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-30 04:45

    https://github.com/guidesmiths/rascal#rascal worth a mention too. It's built on top of amqplib, and has a set of useful features like auto reconnection logic, configuration based subscription / publication and good support for TDD.

    0 讨论(0)
  • 2021-01-30 04:49

    I have been using node-amqp

    npm install amqp
    

    This is the one recommended by RabbitMQ which is why I've been using it. From what I've been doing, this module is more dry and readable compared to the other libraries I have seen.

    0 讨论(0)
  • 2021-01-30 04:53

    This question probably requires an updated answer in 2020.

    You may still refer to bakkerthehacker's answer as to what the different libraries do.

    In 2020:

    1. amqp doesn't seem to be supported anymore. It was last published 2 years ago.
    2. For AMQP 0-9-1 protocol, amqplib is the most widely used library.
    3. For AMQP 1.0 protocol, you could go with rhea.
    0 讨论(0)
提交回复
热议问题