On 10/05/17 08:36, pedro-masterasp wrote:
Regarding my questions I found some of the answers:
Q1: Given that STOMP is a protocol, if I find a NPM library for any of the
other protocols, can I use Node.js with that given protocol?
A1: The answer is yes. For example, using a MQTT library for Node.js, I can
communicate with the ActiveMQ broker. There are usually some quirks that one
has to considerate, but it definitely works.
Q2: If such libraries exist, can you point some?
A2: MQTT: https://www.npmjs.com/package/mqtt
AMQ 1.0 : https://www.npmjs.com/package/amqp10 (doesn't work out of
For AMQP 1.0 there is also https://www.npmjs.com/package/rhea
(disclosure: I am the author)
the box:
http://stackoverflow.com/questions/43873400/unable-to-connect-to-apache-activemq-with-node-js)
STOMP: The recommended STMOPIT library.
Personally I would like to at least see the MQTT library added to the
official documentation, as I believe it would help clear many questions from
users.
Q3: Are there any caveats in using Node.js and ActiveMQ with another
protocol other than STOMP?
A3: Yes. ActiveMQ has weird authentication requirements which lead to
clients using a protocol's supported version to fail on connect (an example
is with the previous AMQP 1.0 npm library).
As of 5.14 it seems ActiveMQ requires a SASL layer, even if you use
ANONYMOUS to authenticate. The examples for clients often don't
explicitly authenticate in any way (as much an issue of the examples -
including those for rhea(!) - as for the broker, since in many cases you
would want to restrict access).
To have the amqp10 client use a SASL layer, just specify a saslMechanism
override on the connect e.g.
client.connect(uri, {'saslMechanism':'ANONYMOUS'})
(For rhea you would just specify a username with no password).
Furthermore, each library has
its quirks, that you need to check. Usually the library's github page or
issues page will give you some light on the integration issues with
ActiveMQ, but it helps if the creators state clear support for ActiveMQ
(which is not always the case).
One other caveat is that not all protocols support all patterns or use
cases. For example, MQTT is a protocol for pub-sub specifically and not
for e.g. a shared task queue.
Q4: Is it possible to use any of the EIPs that ActiveMQ offers with Node.js?
If so, how?
A4: WIP
Regarding this last question ... I don't know of any frameworks to achieve
this for nodejs. I understand I can implement the patterns myself, but then
if I do it, what's the point of using ActiveMQ when compared, lets say, to
RabbitMQ which is lighter and supports more versions of AMQP?
RabbitMQ supports AMQP 0-9-1, 0-9 and 0.8 which were interim releases of
the protocol before it reached full standardisation at 1.0. 0-9is
essentially identical to 0-9-1 which merely removed some unimplemented
stuff from 0-9 and clarified the text to be less ambiguous. 0.8 is also
very similar but lacks a one or two methods. They also have some
proprietary extensions to 0-9-1 to cover some of its missing features
(e.g. acknowledged publication)
There is an also a plugin for 1.0. AMQP 1.0 is quite a different
protocol with different client libraries. Choosing 0-9-1 is really
choosing RabbitMQ, whereas as choosing 1.0, an ISO standard, is
supported by other brokers/services. So I don't think supporting more
versions of AMQP is much of a benefit.
In my eyes, the real power of ActiveMQ lies in its integration with Camel,
otherwise it is just yet another message broker with nothing special to add
(correct me if I am wrong here ... ).
It is developed in the community under an open source license *and* open
governance ('the Apache way'). It supports full JMS semantics (which
RabbitMQ does not) including selectors, message groups, *atomic*
transactions as well as a range of useful extensions such as virtual-
and composite- destinations