activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cameldeng <dqib...@gmail.com>
Subject Why the Spring DataSourceTransactionManager suppress the concurrent number of ActiveMQ consumer
Date Fri, 24 Jan 2014 11:14:29 GMT
hi,guys
I got one strange problem.
when I config a DataSourceTransactionManager with spring xml, the concurrent
consumers of ActiveMQ  were suppressed whatever I change
"maxConcurrentConsumers" property value. I have 5 queues, the concurrent
consumers always kept at 8.

if I remove DataSourceTransactionManager bean, the concurrent consumers
reached the number declared in  "maxConcurrentConsumers" .

The DataSourceTransactionManager work for dataSource, i cannot understand
why it affected to ActiveMQ.

application.xml
[CODE]
     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
        <property name="driverClassName" value="${jdbc.driver}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.user}" />
        <property name="password" value="${jdbc.password}" />
    </bean>

    
    <bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource" />
    </bean>

    
    <bean id="consumerConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
        destroy-method="stop">
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL">
                    <value>tcp://localhost:61616</value>
                </property>
            </bean>
        </property>
        <property name="maxConnections" value="5"></property>
    </bean>
    
    
    <bean id="test_1" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg index="0" value="test_1}" />
    </bean>
    <bean id="test_2" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg index="0" value="test_2}" />
    </bean>
    <bean id="test_3" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg index="0" value="test_3}" />
    </bean>
    <bean id="test_4" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg index="0" value="test_4}" />
    </bean>
    <bean id="test_5" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg index="0" value="test_5}" />
    </bean>

    
    <bean id="testOneMessageListenerContainer"
       
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory"
ref="consumerConnectionFactory"></property>
        <property name="concurrentConsumers" value="1" />
        <property name="maxConcurrentConsumers" value="5" />
        <property name="destination" ref="test_1"></property>
        <property name="messageListener"
ref="demoBusinessListener"></property>
    </bean>
  
    <bean id="testTwoMessageListenerContainer"
       
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory"
ref="consumerConnectionFactory"></property>
        <property name="concurrentConsumers" value="1" />
        <property name="maxConcurrentConsumers" value="5" />
        <property name="destination" ref="test_2"></property>
        <property name="messageListener"
ref="demoBusinessListener"></property>
    </bean>

    <bean id="testThreeMessageListenerContainer"
       
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory"
ref="consumerConnectionFactory"></property>
        <property name="concurrentConsumers" value="1" />
        <property name="maxConcurrentConsumers" value="5" />
        <property name="destination" ref="test_3"></property>
        <property name="messageListener"
ref="demoBusinessListener"></property>
    </bean>

    <bean id="testFourMessageListenerContainer"
       
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory"
ref="consumerConnectionFactory"></property>
        <property name="concurrentConsumers" value="1" />
        <property name="maxConcurrentConsumers" value="5" />
        <property name="destination" ref="test_4"></property>
        <property name="messageListener"
ref="demoBusinessListener"></property>
    </bean>

    <bean id="testFiveMessageListenerContainer"
       
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory"
ref="consumerConnectionFactory"></property>
        <property name="concurrentConsumers" value="1" />
        <property name="maxConcurrentConsumers" value="5" />
        <property name="destination" ref="test_5"></property>
        <property name="messageListener"
ref="demoBusinessListener"></property>
    </bean>
[/CODE]

can someone help me!!!



--
View this message in context: http://activemq.2283324.n4.nabble.com/Why-the-Spring-DataSourceTransactionManager-suppress-the-concurrent-number-of-ActiveMQ-consumer-tp4676736.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message