I am using spring integration to perform parallel processing on channel outputs. I have a requirement that the amount of parallelism that goes on needs to be controllable - so I need to be able to increase it or to lower it dynamically. Here is my current set up:
and in code, when I want to change the amount of parallelism, I run the setCorePoolSize method.Code:<service-activator input-channel="computerInputChannel" ref="computer" method="compute"> <poller task-executor="computerRequestExecutor" fixed-rate="1000"></poller> </service-activator> <task:executor id="computerRequestExecutor" pool-size="1" queue-capacity="100" /> <channel id="computerInputChannel"><queue/></channel>
My problem is that when I increase the core pool size, I get increased parallelism, but when I then decrease the core pool size, the increased parallelism doesn't go away. For example, if the core pool size is set initially to 1, I see the tasks run one at a time. And if it is then set to 5 I see them run 5 at a time. But if I reset it to 1, they'll continue to run 5 at a time.
How can I throttle the parallelism?
I am very new to spring integration and may be approaching this from the wrong angle. Any help or alternate suggestions for how to achieve what I want would be great.
http://forum.springsource.org/showth...s-taskexecutor is pretty much my exact question if what I wrote was unclear - unfortunately it was never answered.