1

So far i've only been able to find concurrency setting in the jms connection factory:

<jms:listener-container connection-factory="myConnectionFactory"
                    task-executor="myTaskExecutor"
                    destination-resolver="myDestinationResolver"
                    transaction-manager="myTransactionManager"
                    concurrency="10">

Is it possible to configure the number of consumers for a single queue? i.e something like:

    <jms:listener destination="playerStatsQueue" ref="playerStatsService"
        method="onMessage" concurrency="100" />

Thanks!~

Urbanleg
  • 6,252
  • 16
  • 76
  • 139

1 Answers1

1

Do not use the namespace but an abstract parent DefaultMessageListenerContainer and create one child instance per listener. That way you can tweak all the properties you need.

<bean id="parentContainer" abstract="true"
    class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory"/>
    <property name="messageListener" ref="messageListener"/>
    <property name="transactionManager" ref="transactionManager"/>
</bean>

<bean id="playerStatsListener parent="parentContainer">
    <property name="destination" ref="playerStatsQueue"/>
    <property name="listener" ref="playerStatsService"/> 
    <property name="concurrency" value="100"/>         
</bean>
Stephane Nicoll
  • 31,977
  • 9
  • 97
  • 89