org.springframework.web.socket.config.WebSocketMessageBrokerStats Java Examples

The following examples show how to use org.springframework.web.socket.config.WebSocketMessageBrokerStats. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSocketMessageBrokerConfigurationSupport.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Bean
public WebSocketMessageBrokerStats webSocketMessageBrokerStats() {
	AbstractBrokerMessageHandler relayBean = stompBrokerRelayMessageHandler();

	// Ensure STOMP endpoints are registered
	stompWebSocketHandlerMapping();

	WebSocketMessageBrokerStats stats = new WebSocketMessageBrokerStats();
	stats.setSubProtocolWebSocketHandler((SubProtocolWebSocketHandler) subProtocolWebSocketHandler());
	if (relayBean instanceof StompBrokerRelayMessageHandler) {
		stats.setStompBrokerRelay((StompBrokerRelayMessageHandler) relayBean);
	}
	stats.setInboundChannelExecutor(clientInboundChannelExecutor());
	stats.setOutboundChannelExecutor(clientOutboundChannelExecutor());
	stats.setSockJsTaskScheduler(messageBrokerTaskScheduler());
	return stats;
}
 
Example #2
Source File: WebSocketMessageBrokerConfigurationSupportTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@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\\], " +
			"outboundChannel\\[pool 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));
}
 
Example #3
Source File: WebSocketMessageBrokerConfigurationSupport.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Bean
public WebSocketMessageBrokerStats webSocketMessageBrokerStats() {
	AbstractBrokerMessageHandler relayBean = stompBrokerRelayMessageHandler();

	// Ensure STOMP endpoints are registered
	stompWebSocketHandlerMapping();

	WebSocketMessageBrokerStats stats = new WebSocketMessageBrokerStats();
	stats.setSubProtocolWebSocketHandler((SubProtocolWebSocketHandler) subProtocolWebSocketHandler());
	if (relayBean instanceof StompBrokerRelayMessageHandler) {
		stats.setStompBrokerRelay((StompBrokerRelayMessageHandler) relayBean);
	}
	stats.setInboundChannelExecutor(clientInboundChannelExecutor());
	stats.setOutboundChannelExecutor(clientOutboundChannelExecutor());
	stats.setSockJsTaskScheduler(messageBrokerTaskScheduler());
	return stats;
}
 
Example #4
Source File: WebSocketMessageBrokerConfigurationSupportTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@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\\], " +
			"outboundChannel\\[pool 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));
}
 
Example #5
Source File: WebSocketMessageBrokerConfigurationSupport.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #6
Source File: WebSocketMessageBrokerConfigurationSupportTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@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));
}