1
votes

I have a JMS queue configured in a Weblogic server. 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 ?
2) Is it mandatory that all JMS queue messages should be consumed by a MDB listener set up in an application server

1

1 Answers

2
votes

1) You can consume messages in a stand-alone Java application without the need for any app server or the like. 2) It is not mandatory to use message-driven beans, you can just implement the MessageListener interface and register it with your QueueReceiver; alternatively you can man a blocking call receive() directly on the QueueReceiver.

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/