[ 
https://issues.apache.org/jira/browse/AMQ-6603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15887117#comment-15887117
 ] 

Tadayoshi Sato commented on AMQ-6603:
-------------------------------------

Hi [~cshannon],

Thank you for your comments, and sorry for my late response.

{quote}
I think the issue is with your configuration. It usually doesn't make sense to 
use a connection pool with a DefaultMessageLIstenerContainer because you want 
to let the DefaultMessageListenerContainer do its own caching.
{quote}

I can see your point, but one itchy situation about it is that Apache Camel has 
long been promoting the combination of {{PooledConnectionFactory}} + DMLC as 
the best practice ({{camel-jms}} is effectively just a DMLC inside).
http://camel.apache.org/activemq.html#ActiveMQ-Usingconnectionpooling

We could say that Apache Camel has been wrong on this, but please note that the 
issue happens only when a {{failover:\(...)}} broker URL is used with 
{{ActiveMQConnectionFactory}} and for a plain {{tcp://...}} URL we see no 
issues even with the above combination. That's why I think there might be 
something that can be improved in ActiveMQ side (especially between 
{{PooledConnectionFactory}} and Failover transport).

Or we could instead argue that the specific combination of Failover transport + 
PooledConnectionFactory + DMLC is evil; in this case, what do you think would 
be the correct configuration if users need to use Failover transport?

{quote}
If you just pass a normal connection factory to the 
DefaultMessageListenerContainer then it should just create 1 connection and 10 
consumers.
{quote}

Yes, but then doesn't the number of connection instances grow proportionately 
to the number of DMLC instances used?  I think that's why people want to use 
{{PooledConnectionFactory}} in combination with DMLC (or {{camel-jms}}).

{quote}
Also you said you could reproduce it without using Spring DMLC. What was your 
setup in that case? 
{quote}

Attached {{pooled-amq-client.zip}} is a reproducer that doesn't use DMLC. I 
admit it's rather a contrived example and mostly just mimics what's being done 
inside DMLC, but it still reproduces the issue with only ActiveMQ.

> Excessive number of consumers when used with PooledConnectionFactory and 
> Failover transport
> -------------------------------------------------------------------------------------------
>
>                 Key: AMQ-6603
>                 URL: https://issues.apache.org/jira/browse/AMQ-6603
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JMS client
>    Affects Versions: 5.14.3
>            Reporter: Tadayoshi Sato
>         Attachments: pooled-amq-client.zip, spring-amq-client.zip
>
>
> When {{PooledConnectionFactory}} is used with Failover transport, 
> insufficient access control settings on the broker result in an excessive 
> number of consumer objects on the broker once the access control settings are 
> properly set. 
> Here is an example Spring XML configuration:
> {code:xml}
> <beans ...>
>   <bean id="jmsConnectionFactory" 
> class="org.apache.activemq.ActiveMQConnectionFactory">
>     <property name="brokerURL" value="failover:(tcp://localhost:61616)" />
>     <property name="userName" value="test" />
>     <property name="password" value="test" />
>   </bean>
>   <bean id="pooledConnectionFactory" 
> class="org.apache.activemq.pool.PooledConnectionFactory">
>     <property name="connectionFactory" ref="jmsConnectionFactory" />
>     <property name="maxConnections" value="10" />
>   </bean>
>   <bean id="jmsContainer" 
> class="org.springframework.jms.listener.DefaultMessageListenerContainer">
>     <property name="connectionFactory" ref="pooledConnectionFactory" />
>     <property name="destinationName" value="TEST" />
>     <property name="messageListener" ref="messageListener" />
>     <property name="concurrentConsumers" value="10" />
>   </bean>
>   <bean id="messageListener" class="com.redhat.issues.amq.SpringJmsConsumer" 
> />
> </beans>
> {code}
> In this configuration we expect only one connection and 10 consumers for 
> {{TEST}} queue, but after following the reproducer steps we see around 10 
> connections and 100 consumers for the queue on hawtio. In the above 
> configuration Spring DMLC is used but we can reproduce the issue without 
> Spring.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to