Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMS: onMessage problem

 
jagadish r
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic