Fix issue with default executor for message channels

This change ensures correct default settings for message channel's
created through the websocket message-broker XML namespace even
when the channels are customized for other reasons -- e.g. to add
a channel interceptor.

Issue: SPR-11623
This commit is contained in:
Rossen Stoyanchev
2014-03-31 09:05:28 +02:00
parent 7b014eaa55
commit 30ea1a3475
3 changed files with 63 additions and 12 deletions

View File

@@ -293,6 +293,17 @@ public class MessageBrokerBeanDefinitionParserTests {
testExecutor("brokerChannel", 102, 202, 602);
}
// SPR-11623
@Test
public void customChannelsWithDefaultExecutor() {
loadBeanDefinitions("websocket-config-broker-customchannels-default-executor.xml");
testExecutor("clientInboundChannel", Runtime.getRuntime().availableProcessors() * 2, Integer.MAX_VALUE, 60);
testExecutor("clientOutboundChannel", Runtime.getRuntime().availableProcessors() * 2, Integer.MAX_VALUE, 60);
assertFalse(this.appContext.containsBean("brokerChannelExecutor"));
}
@Test
public void messageConverters() {
loadBeanDefinitions("websocket-config-broker-converters.xml");

View File

@@ -0,0 +1,30 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:message-broker>
<websocket:stomp-endpoint path="/foo"/>
<websocket:simple-broker prefix="/topic"/>
<websocket:client-inbound-channel>
<websocket:interceptors>
<ref bean="myInterceptor"/>
</websocket:interceptors>
</websocket:client-inbound-channel>
<websocket:client-outbound-channel>
<websocket:interceptors>
<ref bean="myInterceptor"/>
</websocket:interceptors>
</websocket:client-outbound-channel>
<websocket:broker-channel>
<websocket:interceptors>
<ref bean="myInterceptor"/>
</websocket:interceptors>
</websocket:broker-channel>
</websocket:message-broker>
<bean id="myInterceptor" class="org.springframework.web.socket.config.TestChannelInterceptor"/>
</beans>