Dynamically registered beans are unresponsive after some days

Viewed 47

Suppose we have 5 flows and for every flow we are setting pollerMetadata on each flow with common ThreadPoolTaskExecutor.

It seems to me that periodic trigger is getting stuck after few days.

Here is a snapshot of the code for creating a pollerMetadata per flow

ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();

PollerMetadata pollerMetadata = new PollerMetadata();
Trigger trigger = new PeriodicTrigger(2*60*1000L);
pollerMetadata.setTrigger(trigger);
pollerMetadata.setTaskExecutor(executor);

let me know if i am doing something wrong in setting ThreadPoolTaskExecutor or there is something else...?

1 Answers

All the pollers are initiated by the global TaskScheduler which comes with 10 threads by default in plain Spring Integration, and only with 1 in recent Spring Boot.

So, depending on your environment you might need to review those defaults for your project.

Spring Integration one can be customized via global properties:

https://docs.spring.io/spring-integration/docs/current/reference/html/configuration.html#namespace-taskscheduler

The Spring Boot one comes with respective configuration properties for its TaskScheduler auto-configuration:

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.spring-integration

Related