简体   繁体   中英

receive JMS messages in node.js app?

Is it possible to subscribe to a JMS, and receive messages from within a node.js app? Is there a node.js module that will allow this, like the amqp module for amqp messages?

Currently the messages are received by a Java app. However, I am trying to switch to javascript.

Thanks

Short answer: No.

Longer answer: JMS is nothing but an API interface specification in Java. You cannot really use JMS without Java. So, to use generic JMS (any vendor), you need to have some Java glue code (such as seam, or something more custom made) between the JMS implementation and your JavaScript (node.js) app.

AMQP, on the other hand, is more than an API. It's actually a standardized wire protocol, and could therefore be implemented in any language. JMS does not have this luxury.

That said, there might be options for you if you choose to go with specific vendors.

I know out of my head that Apache ActiveMQ has AJAX support, and the same goes (at least partially) for IBM WebSphere MQ as well as JBoss HornetQ (http://www.jboss.org/hornetq/rest.html).

Other options, other than REST/AJAX, is trying to implement or find implementations of the different Wire protcols different JMS vendors uses. For Apache QPid which supports AMQP, this would be easy. STOMP is another lightweight protocol supported by multiple JMS implementations, such as ActiveMQ and HornetQ that you can find node.js/java script libraries for around the Internet.

A more time consuming option would be to write an extension to node.js using a specific implementation C/C++ API (if there is any..) and connect using that. It would (probably) be more reliable than the REST/AJAX approach but also way more time consuming

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM