Reputation: 121
In my Spring-Integration Config, I have Queues, Task Executors. I would like to change the Queue Capacity, Task executors Pool Size and fixed-delay. I would like to have a UI Page and should be able to change the config if there are more messages to be processed or if there is heavy load with out have to rebuild and deploy the application.
Ex:
<si:service-activator input-channel="MessageChannel" ref="messageHandler"
method="handleMessage" output-channel="ackChannel">
<si:poller task-executor="messageTaskExecutor" fixed-delay="1000"/>
</si:service-activator>
<task:executor id="messageTaskExecutor" pool-size="10"
queue-capacity="10" keep-alive="1" rejection-policy="CALLER_RUNS"/>
I would like to change this numbers dynamically and reload the config to pick up the changes. It would be great if you could point me in the right direction.
Upvotes: 1
Views: 2032
Reputation: 3775
You need to inject your Task Executors, Queues and so on as regular beans. And then just set parameters to them at runtime. For example
<task:executor id="messageTaskExecutor" pool-size="10"
queue-capacity="10" keep-alive="1" rejection-policy="CALLER_RUNS"/>
will produce bean of type ThreadPoolExecutor
with name messageTaskExecutor
. So, it may be inject as:
@Autowired @Qualifier("messageTaskExecutor") // or @Inject @Named("messageTaskExecutor")
ThreadPoolExecutor messageTaskExecutor;
After you may just call messageTaskExecutor.setMaximumPoolSize
Upvotes: 1