简体   繁体   English

独立的Java程序中的JMS队列侦听器

[英]JMS queue listeners in a stand alone java program

I have a JMS queue configured in a Weblogic server. 我在Weblogic服务器中配置了JMS队列。 Messages will be sent to this queue from an external service. 消息将从外部服务发送到此队列。

I want to know : 1) If I can consume this message by setting up a message listener in a stand alone java program ? 我想知道:1)是否可以通过在独立的Java程序中设置消息侦听器来使用此消息?
2) Is it mandatory that all JMS queue messages should be consumed by a MDB listener set up in an application server 2)是否必须由应用程序服务器中设置的MDB侦听器使用所有JMS队列消息

1) You can consume messages in a stand-alone Java application without the need for any app server or the like. 1)您可以在独立的Java应用程序中使用消息,而无需任何应用程序服务器等。 2) It is not mandatory to use message-driven beans, you can just implement the MessageListener interface and register it with your QueueReceiver ; 2)使用消息驱动的bean不是强制性的,您只需实现MessageListener接口并将其注册到QueueReceiver即可 alternatively you can man a blocking call receive() directly on the QueueReceiver . 或者,您可以直接在QueueReceiver上进行阻塞调用receive()

Here's a fairly good tutorial with example code that shows how to use JMS in a standalone/non-J2EE app server context: http://www.ibm.com/developerworks/java/tutorials/j-jms/ 这是一个带有示例代码的相当不错的教程,该示例代码显示了如何在独立/非J2EE应用服务器上下文中使用JMS: http : //www.ibm.com/developerworks/java/tutorials/j-jms/

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

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