Augustus Karthik [
http://community.jboss.org/people/augustusk] created the discussion
"JBOSS 5.1 "MessageConsumer.receiveNoWait(...)" strange problem"
To view the discussion, visit:
http://community.jboss.org/message/553680#553680
--------------------------------------------------------------
Hi,
I am have strange problem with JBOSS 5.1.0. I have attached my program below. This program
works perfectly in JBOSS 4.2.3. But fails strangely in Jboss 5.1.0. *The strange thing is
when I run the same program in "DEBUG" mode it works fine*. I couldn't find
whats wrong with this program. Is it something related to Threads? Please help me out..
The Main problem is "MessageConsumer.receiveNoWait(...)" method fails to return
the ObjectMessage from the JMS Queue event though there are many messages in the queue.
Here is the program:
initialContext = getContext();
Queue queue = (Queue) initialContext.lookup("/queue/XQueue");
QueueConnectionFactory cf = (QueueConnectionFactory)
initialContext.lookup("/ConnectionFactory");
connection =
cf.createQueueConnection("caecmibuser","caecmibuser");
QueueSession qSession1 = connection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageConsumer qReceiver = qSession1.createConsumer(queue);
connection.start();
while (true) {
*ObjectMessage message = (ObjectMessage) qReceiver.receiveNoWait();*
//This method always returns null
if (message == null)
break;
}
qReceiver.close();
qSession1.close();
connection.close();
Thanks
Augustus
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/553680#553680]
Start a new discussion in JBoss Messaging at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]