Quantcast
Viewing all articles
Browse latest Browse all 5648

Messages not received after setting the topicPrefetch

Hi,

Below is the config in broker (activemq.xml)

<policyEntry topic="test.>" topicPrefetch="100"
advisoryForDiscardingMessages="true" advisoryForSlowConsumers="true" >
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="43"/>
</pendingMessageLimitStrategy>
</policyEntry>

The publisher is publishing large number of messages continuously. However,
the consumer is consuming only first few messages successfully. After that
the messages published by producer are not consumed by the consumer.

The consumer config is as below -

<bean id="testConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${mq.brokerUrl}"/>
<property name="alwaysSessionAsync" value="true"/>
<property name="copyMessageOnSend" value="false"/>
<property name="optimizeAcknowledge" value="true"/>
<property name="useAsyncSend" value="true"/>
<property name="watchTopicAdvisories" value="false" />
</bean>

<bean id="testPooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
<constructor-arg ref="testConnectionFactory" />
<property name="idleTimeout" value="0" />
</bean>

<bean id="testListenerAdapter"
class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
<property name="delegate" ref="testMessageHandler"/>
</bean>

Why would the consumer receive only first few messages and rest all are
discarded ? If the topicPrefetch is not configured in the broker, then all
works good. However, I want to add prefetch limit to limit the number of
messages buffered on slow consumer.

Viewing all articles
Browse latest Browse all 5648

Trending Articles