activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Shannon <>
Subject Re: Using MessageListener to read up to a limit of message?
Date Mon, 22 Jun 2015 00:40:01 GMT
Right, you will continue to receive messages if you process them.  The
prefetch size is used as an optimization and doesn't have anything to do
with message acknowledgement.  The broker will always try and keep your
prefetch full on your client so you can quickly consume messages. As you
process messages the broker will dispatch more to you regardless of whether
or not you have called commit or acknowledged the messages.  The broker
will keep track of all messages until you actually acknowledge them.

If you want to pause message acknowledgement and wait before consuming more
messages then you should probably use a synchronous consumer instead and
just call "consumer.receive()" and not try and use a messageListener which
is asynchronous.

On Sun, Jun 21, 2015 at 6:35 PM, Kevin Burton <> wrote:

> I have a threaded app .. so let’s say I have 100 threads waiting to do
> work.
> I want an async message listener to read these messages, UP TO 100
> messages, until I can process and commit() them.
> But I don’t think there’s a way to do this.
> I had ASSUMED that setting a prefetch of say 10, and a message listener,
> would only give me 10 messages, until I acknowledged them.
> But this doesn’t seem to be the case. I keep receiving messages on the
> listener.
> --
> Founder/CEO
> Location: *San Francisco, CA*
> blog:
> … or check out my Google+ profile
> <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message