Why does STOMP functionality in spring-websocket depend on Spring MVC?

怎甘沉沦 提交于 2020-01-13 19:42:10

问题


Currently, I am trying to use STOMP with websockets using webflux. In order to send a message to a STOMP topic, I need to use SimpMessagingTemplate, which is contributed by spring boot auto configuration when I add @EnableWebSocketMessageBroker

But the problem with this is, @EnableWebSocketMessageBroker indirectly expects me to have spring-mvc library in classpath

@EnableWebSocketMessageBroker @Imports DelegatingWebSocketMessageBrokerConfiguration which extends WebSocketMessageBrokerConfigurationSupport & WebSocketMessageBrokerConfigurationSupport#stompWebSocketHandlerMapping method expects the class HandlerMapping to be returned

My question is

  1. How to integrate STOMP with webflux without webmvc
  2. Why is the autoconfiguration forcing us to have mvc in classpath (and potentially conflict with webflux)

回答1:


If you search for "stomp webflux" on Google, the very first hit (for me) is an issue in the Spring Boot issue tracker that shortly describes why it isn't supported:

There is a general intent to provide higher-level, messaging support aligned with WebFlux, but there is no specific target release yet. Note that we are researching gRPC and RSocket support, which are in the same general category.

Support for RSocket has been started in the 5.2 line so you may want to have a look to that.



来源:https://stackoverflow.com/questions/55550768/why-does-stomp-functionality-in-spring-websocket-depend-on-spring-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!