You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by vlaxmi <vl...@gmail.com> on 2014/03/20 04:52:23 UTC

prefetch size in broker config (activemq.xml)

Hi,

I want to set the topic prefetch limit such that it will be applied to all
consumers of that topic.

I tried to set the same -
 <destinationPolicy>
            <policyMap>
              <policyEntries>                	
		  <policyEntry topic="test" topicPrefetch="500"
advisoryForDiscardingMessages="true" advisoryForSlowConsumers="true">			
	          	<pendingMessageLimitStrategy>
		  	      <constantPendingMessageLimitStrategy limit="200"/>
                  	</pendingMessageLimitStrategy>
                  </policyEntry>		
              </policyEntries>
            </policyMap>
        </destinationPolicy>

However, it does not set the prefetch size to 500 for the consumer. 

This works only if I set the prefetch on consumer config -
tcp://localhost:61616?jms.prefechPolocy.topicPrefetch=500

Is there any way I can set the topic prefetch in broker config -
activemq.xml ?






--
View this message in context: http://activemq.2283324.n4.nabble.com/prefetch-size-in-broker-config-activemq-xml-tp4679253.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: prefetch size in broker config (activemq.xml)

Posted by vlaxmi <vl...@gmail.com>.
Thanks, It works.

Previous test was not working because in my test the consumer was built with
5.3 and MQ broker was 5.8. 
Once I rebuilt the consumer with 5.8, and set the prefetch size in broker
config, it works as expected.



--
View this message in context: http://activemq.2283324.n4.nabble.com/prefetch-size-in-broker-config-activemq-xml-tp4679253p4679456.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: prefetch size in broker config (activemq.xml)

Posted by Gary Tully <ga...@gmail.com>.
That is the intent. Should be easy to unit test. check the source for
inspiration
On 21 Mar 2014 07:36, "vlaxmi" <vl...@gmail.com> wrote:

> "the broker entries are overrides for the default values. so if the
> client does not specify a value it will have the default and then the
> broker policy will override that. "
> -- If the broker config (activemq.xml) has the topicPrefetch set to 500
> and if the client does not specify a value - then it will have default
> topicPrefetch (which is 32766)
> and then the broker policy will override that -> thus the topicprefect for
> the consumer would be 500. Is that right?
> However, it doesn't appear to be working that way.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/prefetch-size-in-broker-config-activemq-xml-tp4679253p4679391.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: prefetch size in broker config (activemq.xml)

Posted by vlaxmi <vl...@gmail.com>.
"the broker entries are overrides for the default values. so if the
client does not specify a value it will have the default and then the
broker policy will override that. "
-- If the broker config (activemq.xml) has the topicPrefetch set to 500
and if the client does not specify a value - then it will have default
topicPrefetch (which is 32766)
and then the broker policy will override that -> thus the topicprefect for
the consumer would be 500. Is that right?
However, it doesn't appear to be working that way.



--
View this message in context: http://activemq.2283324.n4.nabble.com/prefetch-size-in-broker-config-activemq-xml-tp4679253p4679391.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: prefetch size in broker config (activemq.xml)

Posted by vlaxmi <vl...@gmail.com>.
Thanks for the reply.

"if you want to enforce a broker wide limit that ignores client values then
implementing a broker plugin is the way to go. " 
- Will it be possible to have only specific configuration from broker
configuration and others from client configuration ?  e.g. enforce the
prefetch limit from *broker* wide limit that ignore client values. However,
other configurations like, *jms.useCompression* from *client configuration*.




--
View this message in context: http://activemq.2283324.n4.nabble.com/prefetch-size-in-broker-config-activemq-xml-tp4679253p4679387.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: prefetch size in broker config (activemq.xml)

Posted by Gary Tully <ga...@gmail.com>.
if you want to enforce a broker wide limit that ignores client values
then implementing a broker plugin is the way to go. see examples at:
https://github.com/apache/activemq/tree/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/util

like the https://github.com/apache/activemq/blob/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/util/DestinationPathSeparatorBroker.java

On 20 March 2014 13:57, Gary Tully <ga...@gmail.com> wrote:
> the broker entries are overrides for the default values. so if the
> client does not specify a value it will have the default and then the
> broker policy will override that.
> so the client is in control if it wants to be.
> see the code: https://github.com/apache/activemq/blob/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java#L307
>
> On 20 March 2014 03:52, vlaxmi <vl...@gmail.com> wrote:
>> Hi,
>>
>> I want to set the topic prefetch limit such that it will be applied to all
>> consumers of that topic.
>>
>> I tried to set the same -
>>  <destinationPolicy>
>>             <policyMap>
>>               <policyEntries>
>>                   <policyEntry topic="test" topicPrefetch="500"
>> advisoryForDiscardingMessages="true" advisoryForSlowConsumers="true">
>>                         <pendingMessageLimitStrategy>
>>                               <constantPendingMessageLimitStrategy limit="200"/>
>>                         </pendingMessageLimitStrategy>
>>                   </policyEntry>
>>               </policyEntries>
>>             </policyMap>
>>         </destinationPolicy>
>>
>> However, it does not set the prefetch size to 500 for the consumer.
>>
>> This works only if I set the prefetch on consumer config -
>> tcp://localhost:61616?jms.prefechPolocy.topicPrefetch=500
>>
>> Is there any way I can set the topic prefetch in broker config -
>> activemq.xml ?
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://activemq.2283324.n4.nabble.com/prefetch-size-in-broker-config-activemq-xml-tp4679253.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
>
> --
> http://redhat.com
> http://blog.garytully.com



-- 
http://redhat.com
http://blog.garytully.com

Re: prefetch size in broker config (activemq.xml)

Posted by Gary Tully <ga...@gmail.com>.
the broker entries are overrides for the default values. so if the
client does not specify a value it will have the default and then the
broker policy will override that.
so the client is in control if it wants to be.
see the code: https://github.com/apache/activemq/blob/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java#L307

On 20 March 2014 03:52, vlaxmi <vl...@gmail.com> wrote:
> Hi,
>
> I want to set the topic prefetch limit such that it will be applied to all
> consumers of that topic.
>
> I tried to set the same -
>  <destinationPolicy>
>             <policyMap>
>               <policyEntries>
>                   <policyEntry topic="test" topicPrefetch="500"
> advisoryForDiscardingMessages="true" advisoryForSlowConsumers="true">
>                         <pendingMessageLimitStrategy>
>                               <constantPendingMessageLimitStrategy limit="200"/>
>                         </pendingMessageLimitStrategy>
>                   </policyEntry>
>               </policyEntries>
>             </policyMap>
>         </destinationPolicy>
>
> However, it does not set the prefetch size to 500 for the consumer.
>
> This works only if I set the prefetch on consumer config -
> tcp://localhost:61616?jms.prefechPolocy.topicPrefetch=500
>
> Is there any way I can set the topic prefetch in broker config -
> activemq.xml ?
>
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/prefetch-size-in-broker-config-activemq-xml-tp4679253.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com