简体   繁体   English

在node.js应用程序中接收JMS消息?

[英]receive JMS messages in node.js app?

Is it possible to subscribe to a JMS, and receive messages from within a node.js app? 是否可以订阅JMS,并从node.js应用程序中接收消息? Is there a node.js module that will allow this, like the amqp module for amqp messages? 是否有一个node.js模块允许这个,就像amqp消息的amqp模块一样?

Currently the messages are received by a Java app. 目前,Java应用程序接收消息。 However, I am trying to switch to javascript. 但是,我正在尝试切换到javascript。

Thanks 谢谢

Short answer: No. 简答:不。

Longer answer: JMS is nothing but an API interface specification in Java. 更长的答案:JMS只不过是Java中的API接口规范。 You cannot really use JMS without Java. 没有Java,你无法真正使用JMS。 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. 因此,要使用通用JMS(任何供应商),您需要在JMS实现和JavaScript(node.js)应用程序之间使用一些Java粘合代码(例如seam,或更自定义的东西)。

AMQP, on the other hand, is more than an API. 另一方面,AMQP不仅仅是一个API。 It's actually a standardized wire protocol, and could therefore be implemented in any language. 它实际上是一种标准化的线路协议,因此可以用任何语言实现。 JMS does not have this luxury. JMS没有这种奢侈品。

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). 我不知道Apache ActiveMQ是否支持AJAX,对于IBM WebSphere MQ和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. 除REST / AJAX之外的其他选项是尝试实现或查找不同JMS供应商使用的不同Wire protcols的实现。 For Apache QPid which supports AMQP, this would be easy. 对于支持AMQP的Apache QPid,这很容易。 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. STOMP是另一个由多个JMS实现支持的轻量级协议,例如ActiveMQ和HornetQ,您可以在Internet上找到node.js / java脚本库。

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. 更耗时的选择是使用特定的实现C / C ++ API(如果有的话)编写node.js的扩展并使用它进行连接。 It would (probably) be more reliable than the REST/AJAX approach but also way more time consuming 它(可能)比REST / AJAX方法更可靠,但也更省时

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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