【发布时间】:2016-09-05 13:06:21
【问题描述】:
这是一个与以下相关的问题:
SockJS receive stomp messages from spring websocket out of order
但我不明白如何在消息代理中限制 1 个线程。
【问题讨论】:
-
你可以找到它怎么做here
标签: java spring-websocket
这是一个与以下相关的问题:
SockJS receive stomp messages from spring websocket out of order
但我不明白如何在消息代理中限制 1 个线程。
【问题讨论】:
标签: java spring-websocket
也许定义一个池大小为 1 的任务执行器,并将其设置为您的出站通道的调度程序?目前无法测试,但它可能会起作用。
看看这里https://stackoverflow.com/a/16724743/6404321和这里http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-configuration-performance
【讨论】:
您可以使用注册实例配置另一个属性。
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureClientOutboundChannel(ChannelRegistration registration) {
registration.taskExecutor().maxPoolSize(1);
}
}
【讨论】: