camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oliT <>
Subject Camel keeps adding and removing Consumers when using DefaultMessageListenerContainer
Date Fri, 09 Nov 2007 15:23:50 GMT

hi there,

Spring 2.1 
Camel 1.2 
ActiveMQ 5 the latest snapshot

this is just the minimal configuration to trigger the issue:
  <bean id="jmsFactory"
    <property name="connectionFactory">
      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:6666" />
  <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="jmsFactory" />
    <property name="camelContext" ref="camel" />
    <property name="consumerType" value="Default"></property>

  <bean id="queueTest" factory-bean="camelEndpointFactory"
    <constructor-arg value="jms:queueTest" />

  <!-- CAMEL ROUTES -->

  <bean id="routesType" class="Routes">
    <property name="routes">
        <bean class="">
          <property name="input" ref="queueTest" />
          <property name="output">
              <ref bean="testBean" />

  <bean id="testBean" class="TestBean"></bean>

My Problem:
when i start is minimal sample configuration it keeps creating new consumer
threads on a second basis. So each second i get a new thread. I think this
is a great overhead since the resources are created and destroyed each time. 
I tried setting the consumerType to ServerSessionPool(like in the sample
below) and add a ServerSessionFactory to the JmsComponent but i get this
exception: "Session pool provided an invalid session type: class

<bean id="jms"
  <property name="connectionFactory" ref="jmsFactory" 
  <property name="camelContext" ref="camel" /> 
  <property name="consumerType" value="ServerSessionPool"></property>
  <property name="serverSessionFactory">

I looked into the sourceCode and what i found is that camel, depending on
the consumerType, creates a Simple, Default oder
I cannot use simple since i need the transaction capability of at least the
default container. However i am not satisfied with its behavior. If i run 10
components each using a camel route then 10 consumers per second are created
and destroyed. 
It seems that setting "maxMessagesPerTask" for the jms component will slow
the creation down since he will then create a new thread after X receive
calls (as defined in maxMessagesPerTask).
But the principle Problem stays the same. 
I looked into the sourcecode of the DefaultContainer and it seems to me that
this is the desired behaiviour, and maybe this is needed to give it
transactional capabilities??.

Maybe i am walking in the wrong direction here.. . I tried to use the
Server-Container but i cannot get it running. It seems the
serversessionfactory returns a pooledsession wich itself wraps the ActiveMQ
Session. I could write a wrapper for that myself to "extract" the session,
but i dont feel that is the way it was ment to be.

What are you guy's doing about that? Do you simply live with it or is there
some way around it?

thanks in advance!


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message