SimpMessagingTemplate.convertAndSend with RabbitMQ works very slow

戏子无情 提交于 2019-12-04 17:31:34

问题


I'm using spring STOMP over Websocket with RabbitMQ. All works fine but simpMessagingTemplate.convertAndSend works very slow, call can take 2-10 seconds (synchronously, block thread). What can be a reason??

RabbitTemplate.convertAndSend take < 1s, but I need stomp over websocket..

UPDATE

I try to use ActiveMQ and gets the same result. convertAndSend take 2-10 seconds

ActiveMQ have default configuration.

Web socket config:

@Configuration
@EnableWebSocket
@EnableWebSocketMessageBroker
class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

    @Override
    void configureMessageBroker(MessageBrokerRegistry config) {
        config.enableStompBrokerRelay("/topic", "/queue", "/exchange");
        config.setApplicationDestinationPrefixes("/topic", "/queue"); // prefix in client queries
        config.setUserDestinationPrefix("/user");
    }

    @Override
    void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/board").withSockJS()
    }

    @Override
    void configureWebSocketTransport(WebSocketTransportRegistration registration) {
        registration.setMessageSizeLimit(8 * 1024);
    }
}

回答1:


Problem resolved. Its bug in io.projectreactor library version 2.0.4.RELEASE. I change to 2.0.8.RELEASE and its fixed problem. Sending message now take ~50ms.

    <dependency>
        <groupId>io.projectreactor</groupId>
        <artifactId>reactor-net</artifactId>
        <version>2.0.8.RELEASE</version>
    </dependency>


来源:https://stackoverflow.com/questions/40380069/simpmessagingtemplate-convertandsend-with-rabbitmq-works-very-slow

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