Hi, for the last few days I’ve been trying to solve a fast producers / slow
consumer problem. I want a limited amount of messages fetch on the consumer
(this works) but I also want to have a limited amount of messages in the
queue itself (doesn’t work). I use ActiveMQ 4.1.2 Here is what I tried:

#1 Setup destinations policies
I added this to my activemq.xml

    <destinationPolicy>
      <policyMap><policyEntries>
          <policyEntry queue=">">
            <pendingMessageLimitStrategy>
              <constantPendingMessageLimitStrategy limit="10"/>
            </pendingMessageLimitStrategy>
            <messageEvictionStrategy>
              <oldestMessageEvictionStrategy/>
            </messageEvictionStrategy >
          </policyEntry>
      </policyEntries></policyMap>
    </destinationPolicy>

How can I know if my policies are applied? They don’t seem to be because
when I run my application my queue is growing until out of memory. What I
see from JMX…
-QueueSize of my queue growing forever (with prefetch of 20 & pending limit
of 10 I would expect a max of 30 right?)
-MaximumPendingMessageLimit=0 for the non-durable subscription to this queue


#2 Queue configurations
I tried to set MaximumPendingMessageLimit when I create the queue.
mySession.createQueue(“MyQueue” +
"?consumer.prefetchSize=20&consumer.maximumPendingMessageLimit=10");

What I see from JMX…
-QueueSize of my queue growing forever
-The value for the non-durable subscription to this queue are:
      MaximumPendingMessageLimit=10 
      PrefetchSize=20

#3 Memory limit
As a last resort I tried to set a memory limit on my policyEntry and on my
broker and it is still growing forever.
>From JMX I see the MemoryPercentageUsed always to 0 for both broker and
Queue. I run Broken embedded in the same VM than my application. Maybe it
can explain why.

Could someone help me make my PendingMessageLimit works so I don’t run out
of memory.
Thanks for your help

Yannick


-- 
View this message in context: 
http://www.nabble.com/Fast-producers%2Cslow-consumer...-queue-growing-forever-tp22373306p22373306.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to