Problem with broker template in spring-websocket

我是研究僧i 提交于 2019-12-11 19:03:43

问题


I am using spring-WebSocket for receiving records via WebSocket channel. After receiving them I send it to an external broker like activeMQ.

My configuration looks something like:

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

    @Override
    public void configureMessageBroker(MessageBrokerRegistry config) {
        config.enableSimpleBroker("/topic");
        registry
            .enableStompBrokerRelay("/topic","/queue")
            .setRelayHost("127.0.0.1")
            .setRelayPort(61613);
    }

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/gs-guide-websocket").withSockJS();
    }

}

This works well. Now I am trying to integrate this with a parent project where I get a conflict about multiple beans of type SimpMessagingTemplate being registered. This fails the injection process in the parent application.

I tried overriding the classes to create my template outside spring context but failed to do so.

Any insights would be great.

来源:https://stackoverflow.com/questions/55016259/problem-with-broker-template-in-spring-websocket

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