Integration between Node.js and ActiveMQ - how to use
Asked Answered
E

2

12

Background

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

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 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, a separate project with no support for anything other than Java.

  1. Is it possible to use any of the EIPs that ActiveMQ offers with Node.js? If so, how?
Entrant answered 9/5, 2017 at 12:12 Comment(0)
E
19

Disclaimer

It has been some time since I posted this, and for future reference I am posting my findings here. These findings relate my experience and as of the date of this post they are as accurate as possible.

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:

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: 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. The community failed to provide any feedback regarding this matter, as it seems to be very dependent on Java technologies, without knowledge in other other field.

Conclusion

Overall, if you have a Java project, you would be fine using ActiveMQ. If you want to use anything else, I strongly recommend avoiding it.

Everything either needs Java or some level of integration with it.

You could argue that ActiveMQ supports a large variety of protocols, but so do other tools that actually have support for your own language.

Even in the end, the EIPs provided by Camel, are not really available for for anything other than Java and even the community suggests you implement the patterns yourself, which defeats the whole purpose of using ActiveMQ.

Sources

Community thread: http://activemq.2283324.n4.nabble.com/Integration-between-Node-js-and-ActiveMQ-how-to-use-td4725822.html

Specials thanks to "Gordon Sim-2" the author of rhea. Cool project, go check it out !

Entrant answered 17/5, 2017 at 15:14 Comment(1)
Thanks for posting your fineings, am doing similar research. 1 thing is holding me back is authetication, the docs refer to extending a java class to intercept and build my own auth, but i see it only on java. Perhabs i missed out something, does that mean only java can intercept, and no other languages like python or javascript?Billionaire
A
3

As mentioned by Flame_Phoenix, you can easily use HTTP protocol to publish and receive messages

Publish

Receive

For more information: https://activemq.apache.org/rest

Antisana answered 13/12, 2019 at 8:37 Comment(1)
Can this approach used for Artemis endpoint too? #71384292Spontaneous

© 2022 - 2024 — McMap. All rights reserved.