-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default WebSocketMessageBrokerConfigurer is always overriding custom channel executor #42924
Comments
It looks to me like |
|
We consider this a bug and we're going to add |
Thanks! In the meantime I found a workaround by excluding the |
hello community can I work on this bugs |
Thanks for the offer @jack5505, but I started on this yesterday and forgot to assign myself. The code change is easy, but I'm also trying to create a test. |
When using Spring Websocket with Spring Boot, the latter provides a
WebSocketMessagingAutoConfiguration
which provides a defaultWebSocketMessageBrokerConfigurer
which sets either the single task executor found in the context or the executor named "applicationTaskExecutor" for the inbound and outbound client channels:spring-boot/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfiguration.java
Lines 69 to 80 in 619b24a
spring-boot/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfiguration.java
Lines 94 to 106 in 619b24a
When trying to set a custom executor for my inbound and outbound channels in my custom
WebSocketMessageBrokerConfigurer
implementation, it doesn't have any effect. The issue seems to be, that inDelegatingWebSocketMessageBrokerConfiguration
the list of configurers always (at least in my case), processes the default configurer provided by Spring Boot after my custom one, causing my executor configuration to be overridden with the default one.https://github.com/spring-projects/spring-framework/blob/c2c6bb25c68c231e8eb250809442987512755d62/spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.java#L49-L54
Debugging shows the order:
https://github.com/spring-projects/spring-framework/blob/c2c6bb25c68c231e8eb250809442987512755d62/spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.java#L71-L83
Instead, the
DelegatingWebSocketMessageBrokerConfiguration
should probably always process the default implementation first and then any custom configurers, probably via looking at@Order
annotations. Now I don't know if that is an issue which must be handled in Spring Boot or in Spring Framework, but I can raise the issue in the latter project if you feel like it should be handled there.The text was updated successfully, but these errors were encountered: