Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveMQ and maxPageSize

Tags:

activemq

I would like to set the maxPageSize to a larger number from its default 200.

This is how I set in the activemq.xml file:

<destinationPolicy>
            <policyMap>
              <policyEntries>
              ---
                <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb" maxPageSize="SOME_LARGE_NUMBER">
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

This change helps me get the number of messages in a queue using QueueBrowser.getEnumeration() as it returned 200 even if the number of messages in the queue were greater than 200.

Please see: http://docs.oracle.com/javaee/1.4/api/javax/jms/QueueBrowser.html for QueueBrowser.getEnumeration().

What is the side effect of changing the maxPageSize from 200 to say 1000? Does it affect the broker's performance anyway?

I am not seeing any documentation for this property other than "maximum number of persistent messages to page from store at a time" on this page:

http://activemq.apache.org/per-destination-policies.html

Thanks for your time!

like image 608
serverfaces Avatar asked Oct 22 '22 09:10

serverfaces


1 Answers

Max page size simply indicates the number of messages that will be loaded into memory, so the impact is.. that it will consume more memory.

Reading between the lines though, the reason that you are doing this is an anti-pattern. Queue browsing as part of an application is really a misuse of messaging - a message queue works best when treated as a queue. First in, first out. Not as an array that you scan to see whether a message has arrived.

You are much better off consuming each of the messages, and either:

  1. sorting them onto a bunch of other queues depending on their payload and then processing that second level of queues differently, or
  2. storing the payloads into a database and selecting based on the content.
like image 85
Jakub Korab Avatar answered Nov 11 '22 06:11

Jakub Korab