count number of messages

Hi,How do I count the number of messages on a queue with a message selector? Do I ned to read message by message to count them?Is it possible to make a message stay in queue even after its read?thanksshiva,
[241 byte] By [kshivapada] at [2007-9-19]
# 1

Use a QueueBrowser.You have to iterate through the whole queue (effectively fetching all the messages), but the messages stay in the queue for others to consume.Note that the browser may be a snapshot. It takes time to iterate and it can change while you iterate. Even if your provider offers a cursor like browser, messages can be consumed and produced behind you.

Most vendors have some sort of administrative API to get this information. It would not be considered portable.

zachwiejaa at 2007-7-8 > top of java,Enterprise & Remote Computing,Enterprise Technologies...