File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes JMS: onMessage problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS: onMessage problem" Watch "JMS: onMessage problem" New topic

JMS: onMessage problem

jagadish r

Joined: Aug 29, 2007
Posts: 7
Hi Friends,

How to read all messages from MessageListenr and combined those messages in single string and to display it in response GUI as after calling following code:

queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
queueReceiver = queueSession.createReceiver(queue);

public void onMessage(Message message) {
try {
String text = textMessage.getText();
System.out.println("\n text "+text);
} catch (JMSException jmse){ jmse.printStackTrace( );

Yohan Liyanage
Ranch Hand

Joined: Aug 17, 2007
Posts: 132

The onMessage() method of MessageListener interface is called whenever a message arrives at the queue, to which it is registered. Therefore, I don't see the meaning of "how to get all messages in the queue". It will be called whenever a message arrives to the queue automatically.


Yohan Liyanage
I agree. Here's the link:
subject: JMS: onMessage problem
It's not a secret anymore!