activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <>
Subject Re: Reply:Re: Message priority
Date Mon, 07 Jan 2013 14:07:11 GMT
your important message is in the store, but not in the current memory
Unless we keep all messages in memory (vmcursor), we need to carefully
configure the store cursors use of memory.

There are two problems here.

The first is caching messages on send by the store cursor.
If there is a large batch of low priority messages that cause the cache to
be exhausted, followed by some high priority messages, the high priority
messages will only be read and dispatched when the cache is depleted.
Currently it is not possible for a cached low priority message in memory to
be replaced by a high priority message.
The workaround for this is to disable the cursor cache.
<policyEntry queue="xxx" useCache="false" ..>

The second is paging into memory from the store, to ensure true priority
order this must occur only for dispatch to consumers. By default there is a
periodic message scan to check for priority. This must be disabled,
otherwise a consumer will get a view of the store order as seen by the last
scan rather than at the time it subscribes.

The workaround for this is to disable async expiry processing:
<policyEntry queue="xxx" useCache="false" expireMessagesPeriod="0" >

Lastly, if high priory messages are a must have for each consumer, using
prefetch=1 is necessary, such that every consumer dispatch goes to the
store to find the current highest priority message. Otherwise a batch of
priority ordered messages will be in memory ready to dispatch, irrespective
of new deliveries.

<policyEntry queue="xxx" useCache="false" expireMessagesPeriod="0"
queuePrefetch="1" >

It is a trade off between taking a snapshot and caching or getting the
latest up-to-date information w.r.t to producers.

For active durable topic subscribers we support immediate priority
dispatch, where we bypass the cache if we have a higher priority message
and dispatch it immediately to all subscribers.
We may need to investigate a similar arrangement for queues.

On 7 January 2013 07:40, xawiers <> wrote:

> According to SuoNayi, amq will respect the message priority order if
> vmcursor
> is used.
> If I will use default cursor - I will not get message priority. And this is
> bad. Message priority is very important to me.
> I have tried with storage cursor also:
> One producer, one consumer
> added 10 messages with priority 3
> added 3 messages with priority 5
> added 100000 messages with priority 3
> added 3 messages with priority 5
> consumed 3 messages (all priority 5), consuming 4th message I got message
> with priority 3. Where is my important message ?
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at


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