Open csh0034 opened 3 weeks ago
Ah, hm, IntegrationAutoConfiguration.IntegrationTaskSchedulerConfiguration#taskScheduler
is executed if there's no taskScheduler
bean. TaskSchedulingConfigurations.TaskSchedulerConfiguration#taskSchedulerVirtualThreads
creates such a bean, but only if @EnableScheduling
has been used on the main class.
So I guess we should make IntegrationTaskSchedulerConfiguration
virtual threads aware.
The workaround for now is to add @EnableScheduling
on the main class (or any other @Configuration
class).
@mhalbritter
I understand that IntegrationTaskSchedulerConfiguration
needs to recognize virtual threads.
However, even when adding the following configuration, IntegrationTaskSchedulerConfiguration
is called before TaskSchedulerConfiguration
, and TaskSchedulingConfigurations.TaskSchedulerConfiguration#taskSchedulerVirtualThreads
is not called.
@Configuration
@EnableScheduling
class ScheduleConfig
Is there a priority issue?
Additionally, as mentioned in the initial question, the executor assigned to WebSocketMessageConverterConfiguration
should be TaskSchedulerConfiguration.TaskSchedulerConfiguration#taskSchedulerVirtualThreads
, but this method is not called at all.
WebSocketMessageConverterConfiguration.determineAsyncTaskExecutor
only has the taskScheduler created in IntegrationAutoConfiguration.IntegrationTaskSchedulerConfiguration#taskScheduler
Should I provide a sample for verification?
Should I provide a sample for verification?
Yes, please.
p.s. Even though I'm not using SockJS, I noticed that defaultSockJsSchedulerContainer
is added in WebSocketMessageConverterConfiguration.determineAsyncTaskExecutor
It wasn't there in version 3.3.0, but it appears in version 3.3.1. I don't understand the reason for this change.
It seems that the reason TaskSchedulingConfigurations.TaskSchedulerConfiguration#taskSchedulerVirtualThreads
is not being called is due to AbstractMessageBrokerConfiguration#messageBrokerTaskScheduler.
TaskSchedulingConfigurations.TaskSchedulerConfiguration:
Did not match:
- @ConditionalOnMissingBean (types: org.springframework.scheduling.TaskScheduler,java.util.concurrent.ScheduledExecutorService; SearchStrategy: all) found beans of type 'org.springframework.scheduling.TaskScheduler' messageBrokerTaskScheduler (OnBeanCondition)
The AbstractMessageBrokerConfiguration
in Spring has been modified to use the executor registered in ChannelRegistration, and WebSocketMessagingAutoConfiguration
in Spring Boot has been changed to inject the auto-configured executor into ChannelRegistration
.
However, due to the various Beans declared in Spring's AbstractMessageBrokerConfiguration
, TaskExecutorConfigurations.TaskExecutorConfiguration
in Spring Boot is not called.
TaskExecutorConfigurations.TaskExecutorConfiguration:
Did not match:
- @ConditionalOnMissingBean (types: java.util.concurrent.Executor; SearchStrategy: all) found beans of type 'java.util.concurrent.Executor' clientInboundChannelExecutor, clientOutboundChannelExecutor, brokerChannelExecutor (OnBeanCondition)
I'm adding this comment here because I'm unsure where to raise this issue.
In the PR below, WebSocketMessagingAutoConfiguration has been modified to use a virtual thread executor
Upon checking the taskExecutors being injected, it is taskScheduler.
When used with spring-integration, the following Bean is being configured first.
Is it possible to modify it to allow for auto-configuration?
Below is the configuration added without using auto-configuration.
Of course, the bottom properties are also set.