Get your CodeRanch badge!*
The moose likes JBoss/WildFly and the fly likes Remove JMS message from Queue programatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Remove JMS message from Queue programatically" Watch "Remove JMS message from Queue programatically" New topic
Author

Remove JMS message from Queue programatically

Girish Vasmatkar
Ranch Hand

Joined: Apr 24, 2008
Posts: 199
Hey guys,

I am using jboss AS 5.0, and need to delete a message from queue.

I am using spring as well in the application, with a task scheduler which hits a method which basically gets messages in the queue.

What I want is, after I am done with processing messages in the queue (messages returned by QueueBrowser enumeration), I want them to be deleted from the queue.

I think the JMS spec does not provide this facility, but just want to know if JBOSS Messaging provides this facility ?

Here is the code




This method is called by the scheduler each 15 minutes to see if there are messages available in the queue. If there are some, it does something with them and would try to have them removed, so that the next call to this method will not show the same message which has already been processed earlier.
One more thing, if I manually acknowledge the message, I get an IllegalStateException.
Girish Vasmatkar
Ranch Hand

Joined: Apr 24, 2008
Posts: 199
Anyone going through the same scenario ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remove JMS message from Queue programatically
 
Similar Threads
Message count on Queues
how to consume a specific message from queue
Is it possible to create a listener for JMS's QueueBrowser?
MessageListener in AQ JMS
Issue with MDB and weblogic 9.2