Announcement Announcement Module
Collapse
No announcement yet.
Why DataSourceTransactionManager suppress the concurrent number of ActiveMQ consumer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why DataSourceTransactionManager suppress the concurrent number of ActiveMQ consumer

    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.

    version:
    Spring 3.2.5.RELEASE
    ActiveMq 5.9.0

    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>
    
        <!-- transaction manager, use JtaTransactionManager for global tx -->
        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource" />
        </bean>
    
        <!-- activemq consumer connection -->
        <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>
        
        <!-- i have 5 queues -->
        <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>
    
        <!-- consumer listener container -->
        <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>
    can someone help me!!!
    Last edited by cameldeng; Jan 24th, 2014, 06:17 AM.

  • #2
    Sorry for not getting to this sooner.
    We are in the process of moving to StackOverflow for our forums.

    This question is probably a better candidate for StackOverflow, perhaps against the #spring-jms tag.

    If you do post it there, please reply here with the link.

    Thanks!

    Comment

    Working...
    X