Skip to content

using ThreadPooTaskExecuter in DefaultMessageListenerContainer results in wrong number of activeConsumers [SPR-7455] #12113

@spring-projects-issues

Description

@spring-projects-issues

Tovi Sofer opened SPR-7455 and commented

I created standalone Spring application to consume messages from JMS queue. For that I used DefaultMessageListenerContainer. In order for the container to use thread-pool for the created invokers (and not create a new thread each time) I defined taskExecuter to be org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor.class.

This works OK, except from number of active consumers: I defined concurrentConsumers to be 5 (max is 10), but when I look at jconsole I see activeConsumers=1. (concurrentConsumers is shown as 5).
I didn't change any of ThreadPoolTaskExecuter default definitions - meaning corePoolSize is 1, etc.
When I remove taskExecuter attribute from DefaultMessageListenerContainer definition (and therefore SimpleTaskExecuter is used) I see in jconsole 5 active consumers as expected.

Spring XML file:

<bean id="listenerContainer"
	class="org.springframework.jms.listener.DefaultMessageListenerContainer">
	<property name="concurrentConsumers" value="5" />
	<property name="maxConcurrentConsumers" value="10/>
	<property name="connectionFactory" ref="connectionFactory" />
	<property name="destinationName" value="${server.jms.queue.jndiName}" />
	<property name="destinationResolver" ref="destinationResolver" />
	<property name="messageListener" ref="callbackClientMDP" />
	<property name="sessionTransacted" value="true"/>
	<property name="taskExecutor" ref="taskExecutor"/>
	<property name="idleConsumerLimit" value="${client.jms.listener.idleConsumerLimit}" />
	<property name="idleTaskExecutionLimit" value="${client.jms.listener.idleTaskExecutionLimit}" />
	<property name="receiveTimeout" value="${client.jms.listener.receiveTimeout}" />
</bean>

<!-- Task executer for excuting listeners-invokers.--> 
<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"/>

Please let me know if more info is needed.
I think this can be easily restored.

Thanks.


Reference URL: http://forum.springsource.org/showthread.php?t=93068

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)status: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions