I have a activemq consumer client written using spring JMS. 
It uses a PooledConnectionFactory and DefaultMessageListenerContainer to
pool consumers as follows:
    <bean id="consumerConnectionFactory"
          class="org.apache.activemq.pool.PooledConnectionFactory"
          destroy-method="stop">
        <property name="maxConnections" value="40"/>
        <property name="maximumActiveSessionPerConnection" value="50"/>
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL" value="${recommend_mqurl}"/>
                <property name="useAsyncSend" value="true"/>
            </bean>
        </property>
    </bean>

    <bean id="xxxConsumer"
          class="yyy.xxxConsumer">
        <property name="recommendCenter" ref="recommendCenter"/>
    </bean>

    <bean id="xxxListener"
         
class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
        <constructor-arg ref="xxxConsumer"/>
        <property name="defaultListenerMethod" value="handleMessage"/>
        <property name="messageConverter" ref="xxxConverter"/>
    </bean>

    <bean id="recommendCenterDealListenerContainer"
         
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="consumerConnectionFactory"/>
        <property name="destination" ref="xxxDestination"/>
        <property name="messageListener" ref="xxxListener"/>
        <property name="concurrentConsumers" value="4"/>
        <property name="maxConcurrentConsumers" value="4"/>
    </bean>
The configuration of "xxxConverter" and "xxxDestination" are omitted here.
N.B. I think it is improper to pool consumers.

And Several copies of the client run on different machines, one running copy
on each machine.
For the broker, I set the prefetch size to 10000.
And when I browsed the "Active Consumers" button in "Views" column of the
web console for the broker, I found several connections from each machine to
the broker, and each connection has several sessions "attached", maybe 1, 2,
etc. Some of "Active Consumers" have 10000 messages enqueue, but 0 dequeue.
You can get some information from the follow snapshots got from web console:
<http://activemq.2283324.n4.nabble.com/file/n4669669/Screen_Shot_2013-07-24_at_%E4%B8%8B%E5%8D%885.46.39.png>
 
When I browsed the connection above, I got the following information:
<http://activemq.2283324.n4.nabble.com/file/n4669669/Screen_Shot_2013-07-24_at_%E4%B8%8B%E5%8D%885.47.54.png>
 
I don't know why these "Active Consumers" got the messages from broker to
their prefetch buffers but did not consume any of them.






--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Some-of-active-consumers-have-pending-messages-in-prefetch-buffers-but-consume-none-of-them-tp4669669.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to