spring - SimpleMessageListenerContainer and TaskExecutor always only 1 message processed -
i have simplemessagelistenercontainer
using taskexecutor
(pool size = 15) never process more 1 message @ time. here how configured.
simplemessagelistenercontainer settings are:
concurrentconsumers = 1 (e.g., 1 jms consumer) taskexecutor = instance of java.util.concurrent.threadpoolexecutor
threadpoolexecutor settings are:
corepoolsize = 1 maximumpoolsize= 15 workqueue = linkedblockingqueue<runnable> size 200
my expectation:
i expect 1 jms consumer pull off messages , run them fast possible in 1 of background taskexecutor threads. if 50 messages on queue, pull off 50. run 15 @ time while other 35 held in taskexecutor's linkedblockingqueue
internal queue.
what's happening:
instead, app processes 1 message @ time. in jconsole, have extended container , exposed more jmx attributes task executor status, see "taskexecutor" activecount 1 maximum (e.g. threadpoolexecutor.getactivecount()). threadpoolexecutor
never moves 15. so, jms consumer still processing 1 message @ time taskexecutor thread pool of 15 processing messages.
here's jconsole jmx readings show after flooded queue tons of messages.
concurrentconsumers = maps spring's simplemessagecontainer.concurrentconsumers
activecount = maps threadpoolexecutor.activecount
- minconcurrentconsumers = maps threadpoolexecutor.corepoolsize
- maxconcurrentconsumers = maps threadpoolexecutor.maximumpoolsize
- internalqueuecapacity = maps threadpoolexecutor's linkedblockingqueue size.
what missing? need use different implementation of executor?
i found link helpful in resolving issue:
how configure threadpoolexecutor grow/shrink
my corepoolsize 1 , internally, threadpoolexecutor queued messages , processed queued messages single core thread. setting corepoolsize higher allowed growth of # of threads wanted.