Closed alexandreBaronZnk closed 5 months ago
@alexandreBaronZnk Thanks for creating this issue! Do you happen to have a reproducer that we can try out to observe this behavior?
@mpeddada1 I've create this project that reproduce the log (cf. https://github.com/alexandreBaronZnk/GoogleCloudPlatform-spring-cloud-gcp-issues-2454).
@alexandreBaronZnk Have you tried creating your own bean called taskScheduler
? It seems to work with your sample project.
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(1);
scheduler.setThreadNamePrefix("cron");
scheduler.setDaemon(true);
return scheduler;
}
Closing for now, but please re-open, if you think a change should be made in Spring Cloud GCP.
With the following dependencies :
spring-boot 3.2.0
spring-cloud-gcp 4.9.0
When using the dependency
spring-cloud-gcp-starter-pubsub
and activate the scheduling with this Spring annotation@EnableScheduling
, the following log is displayed in the console :With the debug activated on Spring Boot startup, the following explaination is displayed.
IMHO, a bean named
taskScheduler
must be created even ifspring-cloud-gcp-starter-pubsub
is present. And thread pools for scheduling and pub/sub interactions should be distincts. Perhaps, just add the annotation@AutoConfigureAfter(TaskSchedulingAutoConfiguration.class)
to theGcpPubSubAutoConfiguration
should be enough to have all thread pools created.