Quantcast

Integration between Node.js and ActiveMQ - how to use

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Integration between Node.js and ActiveMQ - how to use

pedro-masterasp
This post was updated on .
Background
----------

I am studying ApacheMQ for a project where we need a message broker. Upon reading the [official page][1] I see some features that I am interested in:

 - Access to messaging [Enterprise Integration Patterns][2] (EIPs)
 - Support for the [STOMP][3], [AMQP][4], [MQTT][5] and [OpenWire][6] protocols

However, following the documentation, it is not clear to me if some of my objectives are possible.

Questions
---------

I understand that in order to use ActiveMQ as a broker, I first need a messaging protocol. According to the documentation on [language support for Node.js][7] ActiveMQ only supports the STOMP protocol for Node.js.

1. 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?
2. If such libraries exist, can you point some?
3. Are there any caveats in using Node.js and ActiveMQ with another protocol other than STOMP?

Regarding EIPs, I also need some clarification. After closer checking, I realized that [EIPs can only be used via Apache Camel][2], a separate project with no support for anything other than Java.

4. Is it possible to use any of the EIPs that ActiveMQ offers with Node.js? If so, how?

  [1]: http://activemq.apache.org/
  [2]: http://activemq.apache.org/enterprise-integration-patterns.html
  [3]: https://stomp.github.io/
  [4]: https://www.amqp.org/
  [5]: http://mqtt.org/
  [6]: http://activemq.apache.org/openwire.html
  [7]: http://activemq.apache.org/cross-language-clients.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Integration between Node.js and ActiveMQ - how to use

Tim Bain
I expect that if you could find a Node library that implemented one of
those other protocols, you'd be able to interact with the broker, but I
can't say for certain since I've never used any of the non-OpenWire
protocols under any language, let alone Node.

Did you already do a Google search for Node implementations of those
protocols? A quick Google search turned up
http://stackoverflow.com/questions/8016075/consuming-jms-messages-by-node-js,
but there may well be other NPMs beyond those.

Regarding EIPs, one option would be to run Camel embedded within the
ActiveMQ broker process, if that would meet your needs.

Alternatively, if you have a Node-based EIP framework that you want to use,
and it is capable of interacting with a JMS 1.x broker, it should be able
to interact with ActiveMQ. But maybe the more relevant question is, "which
specific EIPs are you hoping to use in Node.js with ActiveMQ?" Keep in mind
that EIPs are just patterns, and although a framework like Camel makes some
of them easier to use by writing some of the boilerplate for you, you
always have the option to implement the pattern yourself.

Tim

On Tue, May 9, 2017 at 6:43 AM, pedro-masterasp <[hidden email]> wrote:

> Background
> ----------
>
> I am studying ApacheMQ for a project where we need a message broker. Upon
> reading the [official page][1] I see some features that I am interested in:
>
>  - Access to messaging [Enterprise Integration Patterns][2] (EIPs)
>  - Support for the [STOMP][3], [AMQP][4], [MQTT][5] and [OpenWire][6]
> protocols
>
> However, following the documentation, it is not clear to me if some of my
> objectives are possible.
>
> Questions
> ---------
>
> I understand that in order to use ActiveMQ as a broker, I first need a
> messaging protocol. According to the documentation on [language support for
> Node.js][7] ActiveMQ only supports the STOMP protocol for Node.js.
>
> 1. Given that STOMP is a protocol, if I find a NPM library for any of the
> other protocols, can I use Node.js and ActiveMQ with that given protocol?
> 2. If such libraries exist, can you point some?
> 3. Are there any caveats in using Node.js and ActiveMQ with another
> protocol
> other than STOMP?
>
> Regarding EIPs, I also need some clarification. After closer checking, I
> realized that [EIPs can only be used via Apache Camel][2], a separate
> project with no support for anything other than Java.
>
> 4. Is it possible to use any of the EIPs that ActiveMQ offers with Node.js?
> If so, how?
>
>   [1]: http://activemq.apache.org/
>   [2]: http://activemq.apache.org/enterprise-integration-patterns.html
>   [3]: https://stomp.github.io/
>   [4]: https://www.amqp.org/
>   [5]: http://mqtt.org/
>   [6]: http://activemq.apache.org/openwire.html
>   [7]: http://activemq.apache.org/cross-language-clients.html
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Integration-between-Node-js-and-ActiveMQ-
> how-to-use-tp4725822.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Integration between Node.js and ActiveMQ - how to use

pedro-masterasp
Hello Tim,

Thank you for your reply. I highly appreciate it.

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 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). 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).

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?

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 ... ).

With this in mind, I am aware that I can integrate Camel with the ActiveMQ broker. But how would I use Node.js and configure the Camel routes then? These can only be configured via the the DSL's present in this page:
http://camel.apache.org/dsl.html

The majority of them are for Java environments. I guess I could give a shot to the REST DSL, but I am not sure how I would make it work. Would this approach work?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Integration between Node.js and ActiveMQ - how to use

Gordon Sim-2
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Integration between Node.js and ActiveMQ - how to use

pedro-masterasp
Thank for your reply Gordon. I will be sure to mention you (and your work) around when I finally get this tackled.

Does anyone have any input regarding my question 4?

Q4: Is it possible to use any of the EIPs that ActiveMQ offers with Node.js?  If so, how?

A4 (WIP): I believe this would still be possible via the REST DSL with XML (even though we don't use Spring nor anything like that) but I can't find anything nor anyone actually using it. Any input?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Integration between Node.js and ActiveMQ - how to use

pedro-masterasp
Thank you everyone for the help.

After our analysis we have decided to move away from ActiveMQ as find its competitors more appealing.

Special thanks to Gordon, I have given word of his project. I wish you all good luck.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Integration between Node.js and ActiveMQ - how to use

clebertsuconic
I'm not sure what you mean by appealing...


Did you look into artemis at least?

http://activemq.apache.org/artemis/



We have been working quite hard to make it a great broker beyond any
sort of hypes... it's a solid codebase and being proof to be high
performant.


The AMQP protocol has been greatly improved on this last 2 releases..
2.0 and mainly 2.1....

we have been doing a lot of activities on the codebase... just look at
the github activities for how much activity you would find it:


https://github.com/apache/activemq-artemis/graphs/contributors




However, if you are looking for the hyper and cool...we can only
guarantee the quality of the code and do our daily work to make it
better...


Have a nice and good luck anyways.


On Wed, May 17, 2017 at 11:03 AM, pedro-masterasp <[hidden email]> wrote:

> Thank you everyone for the help.
>
> After our analysis we have decided to move away from ActiveMQ as find its
> competitors more appealing.
>
> Special thanks to Gordon, I have given word of his project. I wish you all
> good luck.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Integration-between-Node-js-and-ActiveMQ-how-to-use-tp4725822p4726255.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



--
Clebert Suconic
Loading...