Configure WebSocket thread pools

This commit is contained in:
Charles Gould 2017-01-04 19:56:41 -05:00
parent bcebf43063
commit f8c7efabf4

View File

@ -1,6 +1,7 @@
package lingo.server;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
@ -10,6 +11,18 @@ import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureClientInboundChannel(ChannelRegistration registration) {
// Single thread unless/until more threads are needed
registration.taskExecutor().corePoolSize(1);
}
@Override
public void configureClientOutboundChannel(ChannelRegistration registration) {
// Single thread unless/until more threads are needed
registration.taskExecutor().corePoolSize(1);
}
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");