I'm using the following configuration with Springboot 1.4/Java 1.8, Camel
2.15.1.

In JMX I can see 8 consumers objects on the listening queue, but the
consumers are replaced with new ones, verified by session ID, every second.
This started happening the moment I changed from CACHE_CONSUMER/prefetch=200
to CACHE_NONE/prefetch=1. I cannot understand why this is happening;
idleConsumerLimit=3600000 (1 hour), but it appears Camel is
creating/destroying consumer sessions every second, even when queue is
empty. I verified the connection is being reused, so this appears to be
purely session related.

*Spring Config*
    <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="configuration" ref="jmsConfig" />
    </bean>
    <bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
        <property name="cacheLevelName"          value="CACHE_NONE" />
        <property name="testConnectionOnStartup" value="true" />
        <property name="idleConsumerLimit"       value="3600000" />
        <property name="connectionFactory"      
ref="pooledConnectionFactory" />
    </bean>
    <bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
        init-method="start" destroy-method="stop">
        <property name="maxConnections"     value="2" />
        <property name="expiryTimeout"      value="3600000" />
        <property name="idleTimeout"        value="3600000" />
        <property name="connectionFactory"  ref="connectionFactory" />
        <property name="maximumActiveSessionPerConnection" value="25"/>
    </bean>
    <bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="clientIDPrefix" value="route_name" />
        <property name="brokerURL"      value="${mq.broker-url}" />
        <property name="userName"       value="${mq.user}" />
        <property name="password"       value="${mq.password}" />
        <property name="optimizeAcknowledge" value="true" />
    </bean>

*In Camel...*
       <route id="fromQueueToDb" autoStartup="true" >
            <from  uri="activemq:queue:myQueue?concurrentConsumers=8&amp;
         
destination.consumer.prefetchSize=1";&amp;selector=CamelJacksonUnmarshalType='TestClass'"
/>



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-consumers-created-destroyed-every-second-tp5792215.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to