【问题标题】:How to configure 1 thread limit for the clientOutboundChannel of spring Message Broker?spring Message Broker的clientOutboundChannel如何配置1个线程限制?
【发布时间】:2016-09-05 13:06:21
【问题描述】:

这是一个与以下相关的问题:

SockJS receive stomp messages from spring websocket out of order

但我不明白如何在消息代理中限制 1 个线程。

【问题讨论】:

  • 你可以找到它怎么做here

标签: java spring-websocket


【解决方案1】:

也许定义一个池大小为 1 的任务执行器,并将其设置为您的出站通道的调度程序?目前无法测试,但它可能会起作用。

看看这里https://stackoverflow.com/a/16724743/6404321和这里http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-configuration-performance

【讨论】:

    【解决方案2】:

    您可以使用注册实例配置另一个属性。

    @Configuration
    @EnableWebSocketMessageBroker
    public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
    
        @Override
        public void configureClientOutboundChannel(ChannelRegistration registration) {
            registration.taskExecutor().maxPoolSize(1);
        }
    
    }
    

    【讨论】:

      猜你喜欢
      • 2013-02-08
      • 2011-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多