| Author |
Spring JMS - DefaultMessageListenerContainer and taskExecuter
|
tovi sofer
Greenhorn
Joined: Jun 15, 2008
Posts: 9
|
|
Hi,
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 ThreadPoolTaskExecuter (for JAVA 5). This work 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.
Also I saw in DefaultMessageListenerContainer.setTaskExceuter the following javadoc which I didn't understand:
Specify an alternative TaskExecutor for integration with an existing
thread pool. Note that this really only adds value if the threads are
managed in a specific fashion, for example within a J2EE environment.
A plain thread pool does not add much value, as this listener container
will occupy a number of threads for its entire lifetime.
Is that true? is using ThreadPoolTaskExceuter really gives me no benefit? what about reusing threads?
Thanks in advance.
|
 |
 |
|
|
subject: Spring JMS - DefaultMessageListenerContainer and taskExecuter
|
|
|