[JBoss-dev] Issue in JMS queue consumption using receiveNoWait method

Ansari ThameemAnsari_N at infosys.com
Wed Apr 22 10:28:00 EDT 2009


Hi all,

We are looking for a standalone program to read the messages from a JMS
queue configured. 

This message reading should be synchronous. It should read and process all
the available messages in the queue. All processed valid messages should be
removed from the queue and rest of the messages (invalid/improper should
remain in the queue itself). 

We wrote a client program to do the same (attach our piece of code). We used
receiveNoWait function available over message consumer class. Even though
messages are there in the queue (which we confirmed by writing a sample
program by creating the message browser), recieveNoWait method returns null.
(We tried by running the sample program even after some 30 minutes and one
hour) 

Actually there are two parts in our query 

1) receiveNoWait function available over message consumer class is not
returning the messages available in queue, it’s always returning null. (Even
though messages present in the queue, which we confirmed by writing a
message browser). We are concerned about this issue very much 

2) After processing each and every message, only valid messages should get
removed from the queue. In your response you have mentioned that message can
be put into some other queue if it’s invalid. But our requirement is that
the invalid messages should remain over there in the queue itself. Only
valid messages should be removed from the queue. This can be achieved by
creating a transacted session of message consumer for reading each and every
message. If it’s a valid message, the session will be committed and the
message will be removed from the queue, else it remains in the queue itself.
We tested this with other AppServers and it works fine. 

Uploaded test program for reference

Our main concern is with the 1st part of our query. Expecting your guidance
for the same

Can you please help on this?
http://www.nabble.com/file/p23175484/TestMessageConsumer.java
TestMessageConsumer.java 
-- 
View this message in context: http://www.nabble.com/Issue-in-JMS-queue-consumption-using-receiveNoWait-method-tp23175484p23175484.html
Sent from the JBoss - Dev mailing list archive at Nabble.com.





More information about the jboss-development mailing list