aspose file tools*
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
Author

JMS: onMessage problem

jagadish r
Greenhorn

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);
queueReceiver.setMessageListener(this);
queueConnection.start();
...
...
....

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

-Regards,
jagdish
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.

Regards.


Yohan Liyanage
http://blog.yohanliyanage.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMS: onMessage problem