RE: Non-destructive listener?
"Tim Anderson" <[email protected]>
| Newsgroups | gmane.comp.java.openjms.user |
|---|---|
| Message-ID | <[email protected]> |
> From: Nicolaus.Bauman-SWCg6hSX5lit/[email protected] > > I totally agree, my needs are much better suited for topics. > Alas, I don't have that choice. > > One last question: the approach you describe works because > while the browser scans for a message on the queue, it locks > the messages until the scan is complete. Is that a correct > assumption? If so, then, yeah, that does sound VERY > resource-intensive. > > Thanks so much for such a clear and succinct response. The browser doesn't lock the queue. The approach works because the browser is used to scan the queue, and individual messages are subsequently synchronously consumed using a QueueReceiver. E.g, suppose the queue contains messages A, B, and C. Using a queue browser, you determine you want to consume message B. So you construct a QueueReceiver with a selector: "JMSMessageID='" + B.getJMSMessageID() + "'" and consume the message using the receive() method. That leaves messages A and C in the queue. If message D is subsequently added to the queue, a subsequent scan with a browser will see messages, A, C, and D. Its resource intensive in that you need to continuously scan the queue to pick up new messages. -Tim ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php