The <splitter/> element now creates its own endpoint (i.e. it is no longer necessary to create a <handler-endpoint/> as well) (INT-283). Also, the <handler-endpoint/>'s "handler" attribute has been replaced with "ref" to be more consistent with other spring configuration options (e.g. defining jms-listeners with the JMS namespace support).

This commit is contained in:
Mark Fisher
2008-07-06 17:36:42 +00:00
parent 1b90086e4e
commit a83e39b6ce
31 changed files with 212 additions and 129 deletions

View File

@@ -12,7 +12,7 @@
<channel id="inputChannel"/>
<channel id="outputChannel"/>
<handler-endpoint input-channel="inputChannel" handler="simpleHandler" output-channel="outputChannel"/>
<handler-endpoint input-channel="inputChannel" ref="simpleHandler" output-channel="outputChannel"/>
<beans:bean class="org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor">
<beans:constructor-arg ref="internal.MessageBus"/>

View File

@@ -19,7 +19,7 @@
<handler ref="handler3"/>
</handler-chain>
<handler-endpoint input-channel="testChannel" handler="chain" output-channel="replyChannel">
<handler-endpoint input-channel="testChannel" ref="chain" output-channel="replyChannel">
<schedule period="100"/>
</handler-endpoint>

View File

@@ -11,7 +11,7 @@
<channel id="testChannel"/>
<handler-endpoint id="endpoint" input-channel="testChannel" handler="testHandler" reply-handler="replyHandler"/>
<handler-endpoint id="endpoint" input-channel="testChannel" ref="testHandler" reply-handler="replyHandler"/>
<beans:bean id="testHandler" class="org.springframework.integration.config.TestHandler">
<beans:property name="replyMessageText" value="foo"/>

View File

@@ -12,7 +12,7 @@
<queue-channel id="testChannel" capacity="50"/>
<handler-endpoint id="endpoint" input-channel="testChannel"
handler="testHandler" selector="typeSelector">
ref="testHandler" selector="typeSelector">
<schedule period="100"/>
</handler-endpoint>

View File

@@ -11,7 +11,7 @@
<queue-channel id="testChannel" capacity="50"/>
<handler-endpoint input-channel="testChannel" handler="testBean" method="store">
<handler-endpoint input-channel="testChannel" ref="testBean" method="store">
<schedule period="100"/>
</handler-endpoint>

View File

@@ -15,14 +15,14 @@
<handler-endpoint id="handlerEndpointWithoutAdvice"
input-channel="testChannel"
handler="testHandler"
ref="testHandler"
output-channel="replyChannel">
<schedule period="100"/>
</handler-endpoint>
<handler-endpoint id="handlerEndpointWithAdvice"
input-channel="testChannel"
handler="testHandler"
ref="testHandler"
output-channel="replyChannel">
<schedule period="100"/>
<interceptors>

View File

@@ -11,7 +11,7 @@
<queue-channel id="testChannel" capacity="50"/>
<handler-endpoint input-channel="testChannel" handler="testHandler">
<handler-endpoint input-channel="testChannel" ref="testHandler">
<schedule period="100"/>
</handler-endpoint>

View File

@@ -14,7 +14,7 @@
<handler-endpoint id="required"
input-channel="input"
handler="testBean"
ref="testBean"
method="good"
output-channel="output">
<schedule period="10000"/>
@@ -25,7 +25,7 @@
<handler-endpoint id="requiresNew"
input-channel="input"
handler="testBean"
ref="testBean"
method="good"
output-channel="output">
<schedule period="10000"/>
@@ -36,7 +36,7 @@
<handler-endpoint id="supports"
input-channel="input"
handler="testBean"
ref="testBean"
method="good"
output-channel="output">
<schedule period="10000"/>
@@ -47,7 +47,7 @@
<handler-endpoint id="notSupported"
input-channel="input"
handler="testBean"
ref="testBean"
method="good"
output-channel="output">
<schedule period="10000"/>
@@ -58,7 +58,7 @@
<handler-endpoint id="mandatory"
input-channel="input"
handler="testBean"
ref="testBean"
method="good"
output-channel="output">
<schedule period="10000"/>

View File

@@ -14,7 +14,7 @@
<channel id="output"/>
<handler-endpoint input-channel="badInput"
handler="testBean"
ref="testBean"
method="bad"
output-channel="output">
<schedule period="100"/>
@@ -24,7 +24,7 @@
</handler-endpoint>
<handler-endpoint input-channel="goodInput"
handler="testBean"
ref="testBean"
method="good"
output-channel="output">
<schedule period="100"/>

View File

@@ -18,16 +18,16 @@
<si:channel id="replyChannel"/>
<si:channel id="customErrorChannel"/>
<si:handler-endpoint input-channel="channel1WithOverride" handler="testBean" method="duplicate"
<si:handler-endpoint input-channel="channel1WithOverride" ref="testBean" method="duplicate"
output-channel="channel2" return-address-overrides="true"/>
<si:handler-endpoint input-channel="channel3WithOverride" handler="testBean" method="duplicate"
<si:handler-endpoint input-channel="channel3WithOverride" ref="testBean" method="duplicate"
return-address-overrides="true"/>
<si:handler-endpoint input-channel="channel1" handler="testBean" method="duplicate" output-channel="channel2"/>
<si:handler-endpoint input-channel="channel2" handler="testBean" method="duplicate" output-channel="channel3"/>
<si:handler-endpoint input-channel="channel3" handler="testBean" method="duplicate"/>
<si:handler-endpoint input-channel="channel4" handler="testBean" method="duplicate" output-channel="replyChannel"/>
<si:handler-endpoint input-channel="channel1" ref="testBean" method="duplicate" output-channel="channel2"/>
<si:handler-endpoint input-channel="channel2" ref="testBean" method="duplicate" output-channel="channel3"/>
<si:handler-endpoint input-channel="channel3" ref="testBean" method="duplicate"/>
<si:handler-endpoint input-channel="channel4" ref="testBean" method="duplicate" output-channel="replyChannel"/>
<bean id="testBean" class="org.springframework.integration.endpoint.TestBean"/>

View File

@@ -11,7 +11,7 @@
<channel id="requestChannel"/>
<handler-endpoint handler="handler" input-channel="requestChannel"/>
<handler-endpoint ref="handler" input-channel="requestChannel"/>
<beans:bean id="proxy" class="org.springframework.integration.gateway.GatewayProxyFactoryBean">
<beans:property name="serviceInterface" value="org.springframework.integration.gateway.TestService"/>

View File

@@ -15,7 +15,7 @@
<interceptor ref="interceptor"/>
</channel>
<handler-endpoint handler="handler" input-channel="requestChannel"/>
<handler-endpoint ref="handler" input-channel="requestChannel"/>
<beans:bean id="proxy" class="org.springframework.integration.gateway.GatewayProxyFactoryBean">
<beans:property name="serviceInterface" value="org.springframework.integration.gateway.TestService"/>

View File

@@ -121,7 +121,8 @@ public class CorrelationIdTests {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
channelRegistry.registerChannel("testChannel", testChannel);
SplitterMessageHandlerAdapter splitter = new SplitterMessageHandlerAdapter(
new TestBean(), TestBean.class.getMethod("split", String.class), "testChannel");
new TestBean(), TestBean.class.getMethod("split", String.class));
splitter.setOutputChannelName("testChannel");
splitter.setChannelRegistry(channelRegistry);
splitter.afterPropertiesSet();
splitter.handle(message);

View File

@@ -157,7 +157,8 @@ public class SplitterMessageHandlerAdapterTests {
@Test(expected=MessagingException.class)
public void testInvalidReturnType() throws Exception {
Method splittingMethod = this.testBean.getClass().getMethod("invalidParameterCount", String.class, String.class);
SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(testBean, splittingMethod, "testChannel");
SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(testBean, splittingMethod);
adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
StringMessage message = new StringMessage("foo.bar");
@@ -167,8 +168,9 @@ public class SplitterMessageHandlerAdapterTests {
@Test
public void testSplitPayloadToStringArrayConfiguredByMethodName() throws Exception {
StringMessage message = new StringMessage("foo.bar");
SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(
testBean, "stringToStringArray", "testChannel");
SplitterMessageHandlerAdapter adapter =
new SplitterMessageHandlerAdapter(testBean, "stringToStringArray");
adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
adapter.handle(message);
@@ -183,8 +185,9 @@ public class SplitterMessageHandlerAdapterTests {
@Test
public void testSplitMessageToStringArrayConfiguredByMethodName() throws Exception {
StringMessage message = new StringMessage("foo.bar");
SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(
testBean, "messageToStringArray", "testChannel");
SplitterMessageHandlerAdapter adapter =
new SplitterMessageHandlerAdapter(testBean, "messageToStringArray");
adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
adapter.handle(message);
@@ -199,8 +202,9 @@ public class SplitterMessageHandlerAdapterTests {
@Test
public void testSplitStringToMessageListConfiguredByMethodName() throws Exception {
StringMessage message = new StringMessage("foo.bar");
SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(
testBean, "stringToMessageList", "testChannel");
SplitterMessageHandlerAdapter adapter =
new SplitterMessageHandlerAdapter(testBean, "stringToMessageList");
adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
adapter.handle(message);
@@ -250,7 +254,9 @@ public class SplitterMessageHandlerAdapterTests {
private SplitterMessageHandlerAdapter getAdapter(String methodName) throws Exception {
Class<?> paramType = methodName.startsWith("message") ? Message.class : String.class;
Method splittingMethod = this.testBean.getClass().getMethod(methodName, paramType);
SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(testBean, splittingMethod, "testChannel");
SplitterMessageHandlerAdapter adapter =
new SplitterMessageHandlerAdapter(testBean, splittingMethod);
adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
return adapter;

View File

@@ -15,7 +15,7 @@
<channel id="output2"/>
<handler-endpoint handler="router" input-channel="input"/>
<handler-endpoint ref="router" input-channel="input"/>
<router id="router" ref="pojo" method="route"/>

View File

@@ -13,9 +13,8 @@
<channel id="channel2"/>
<handler-endpoint handler="splitter" input-channel="channel1"/>
<splitter id="splitter" ref="pojo" method="split" output-channel="channel2"/>
<splitter id="splitter" ref="pojo" method="split"
input-channel="channel1" output-channel="channel2"/>
<beans:bean id="pojo" class="org.springframework.integration.router.config.TestSplitter"/>