activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Shannon <>
Subject Re: Custom code to browse messages in the message store?
Date Thu, 15 Dec 2016 16:51:36 GMT
You should be able to implement your own MessageRecoveryListener and
use the recover() or recoverNextMessages() methods on the MessageStore
interface.  The MessageStore object is part of the region Queue (it is
inherited from the parent BaseDestination class)

Calling that method will iterate over each message in the store, load
it into memory and then and pass it to the MessageRecoveryListener
that you provide.  If you are using KahaDB then calling these methods
will lock the index and prevent other writes/reads from the store
while executing the method.

On Thu, Dec 15, 2016 at 11:09 AM, jahlborn <> wrote:
> We have activemq embedded in our product.  Since it runs in the same jvm, we
> have various resource limits in place.  These limits make the browsing
> functionality somewhat less than ideal (you can only read so many messages
> in a large queue).  I was wondering if someone who has deeper knowledge of
> activemq could suggest a way to read messages directly from the data store
> (or some other way to do unbounded browsing which doesn't use up all system
> memory).
> I already attempted this a bit myself by adding a method to the region Queue
> for first pulling from the "paged in" messages, and then directly from the
> "PendingMessageCursor messages" to read messages.  However, despite the fact
> that the cursor is backed by the message store, it still seems to want to
> "page in" messages, and also abides by the resource limits.  (i was
> borrowing code from Queue.getMessage(String id)).
> Is there any way to "bypass" the "paging in" logic and just read messages
> directly from the message store?  i'm okay with this being "slow", i'd
> prefer to have a solution which works slowly rather than no solution at
> all...
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at

View raw message