use of org.springframework.web.socket.config.WebSocketMessageBrokerStats in project spring-framework by spring-projects.
the class WebSocketMessageBrokerConfigurationSupport method webSocketMessageBrokerStats.
@Bean
public WebSocketMessageBrokerStats webSocketMessageBrokerStats() {
AbstractBrokerMessageHandler relayBean = stompBrokerRelayMessageHandler();
StompBrokerRelayMessageHandler brokerRelay = (relayBean instanceof StompBrokerRelayMessageHandler ? (StompBrokerRelayMessageHandler) relayBean : null);
// Ensure STOMP endpoints are registered
stompWebSocketHandlerMapping();
WebSocketMessageBrokerStats stats = new WebSocketMessageBrokerStats();
stats.setSubProtocolWebSocketHandler((SubProtocolWebSocketHandler) subProtocolWebSocketHandler());
stats.setStompBrokerRelay(brokerRelay);
stats.setInboundChannelExecutor(clientInboundChannelExecutor());
stats.setOutboundChannelExecutor(clientOutboundChannelExecutor());
stats.setSockJsTaskScheduler(messageBrokerTaskScheduler());
return stats;
}
use of org.springframework.web.socket.config.WebSocketMessageBrokerStats in project spring-framework by spring-projects.
the class WebSocketMessageBrokerConfigurationSupportTests method webSocketMessageBrokerStats.
@Test
public void webSocketMessageBrokerStats() {
ApplicationContext config = createConfig(TestChannelConfig.class, TestConfigurer.class);
String name = "webSocketMessageBrokerStats";
WebSocketMessageBrokerStats stats = config.getBean(name, WebSocketMessageBrokerStats.class);
String actual = stats.toString();
String expected = "WebSocketSession\\[0 current WS\\(0\\)-HttpStream\\(0\\)-HttpPoll\\(0\\), " + "0 total, 0 closed abnormally \\(0 connect failure, 0 send limit, 0 transport error\\)\\], " + "stompSubProtocol\\[processed CONNECT\\(0\\)-CONNECTED\\(0\\)-DISCONNECT\\(0\\)\\], " + "stompBrokerRelay\\[null\\], " + "inboundChannel\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " + "outboundChannelpool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " + "sockJsScheduler\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\]";
assertTrue("\nExpected: " + expected.replace("\\", "") + "\n Actual: " + actual, actual.matches(expected));
}
Aggregations