Re: QueueBrowser and unacked received messages

Tim Anderson <[email protected]> Fri, 14 Jul 2006 07:27:28 +1000
Newsgroups gmane.comp.java.openjms.user
Message-ID <[email protected]>
Anders Bogdan wrote:
> Greetings!
> I was wondering if someone could explain or suggest a solution to the  
> behavior I'm seeing?
>
> using openjms-0.7.6.1, and a queue.
> I'm trying to avoid having functionally equivalent jms messages on  
> the queue at the same time.
>
> I thought I could determine this by using a QueueBrowser and a  
> message selector but apparently queued messages that are received but  
> not ack'd (and take quite awhile to process) are skipped by the  
> selector - at least they aren't returned in the browsers enumeration.
>
> Is there a way to detect messages in this condition?
> In my scenario the jms messages represent a request for a service and  
> it doesn't make sense to have multiple copies of the same request on  
> the queue at the same time.
>
> Thanks.
>   
Once a message has been delivered, it is not available to QueueBrowsers, 
unless
they had that message cached locally.
You could use a second queue that the processor could use to indicate 
that it is processing a request.
This would be consumed by the processor once the processing is complete.
The sender would check this second queue before issuing requests.

However, it sounds like you need a different approach. Have you looked 
at QueueRequestor?
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/QueueRequestor.html

-Tim



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642