最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Integration between Node.js and ActiveMQ - how to use - Stack Overflow

programmeradmin3浏览0评论

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:

  • Access to messaging Enterprise Integration Patterns (EIPs)
  • Support for the STOMP, AMQP, MQTT and OpenWire 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 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?

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:

  • Access to messaging Enterprise Integration Patterns (EIPs)
  • Support for the STOMP, AMQP, MQTT and OpenWire 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 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?
Share Improve this question edited May 9, 2017 at 13:31 Flame_Phoenix asked May 9, 2017 at 12:12 Flame_PhoenixFlame_Phoenix 17.6k40 gold badges143 silver badges283 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 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:

  • MQTT: mqtt
  • AMQP 1.0 : amp10 and rhea. They don't work out of the box - see 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: 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 !

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

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

发布评论

评论列表(0)

  1. 暂无评论