I have tried the method on JBM 1.4.0 SP1, and I am still unable to get messages using listAllMessages when a message consumer is connected to the queue.
Is there any way to monitoring queue content in JBM when the queue is actively consumed by message consumer?
Thank you in advance.
p.s. JBoss Server used is 4.2.0.G.A
Each MessageConsumer maintains its own buffer of messages (see prefetchSize in the documentation), which are prefetched from the queue/subscription before they are actually consumed.
IIRC the prefetch size default is 150. So, if you have a consumer open and even if you haven't consumed any messages, 150 will have been removed from the queue, since they're not in the queue you won't be able to see them with listAllMessages (or browse them or any other similar methods).
Probably you have less than 150 messages in your queue hence they've all been buffered and you see none.
This has been discussed in depth on other threads.......
thank you for your explanation.
Is there any possiblity to see all messages in the buffer?
Or, is there any plan in the future to implement such kind of methods?
The problem is the messages are no longer on the server side, the buffers are on the client side.
So the server would have to query every single consumer (maybe thousands) to find out what is in their buffers which is not really practical.
We could store a copy of them on the server side, but there would be performance implications of doing this.