Both "source-endpoint" and "target-endpoint" elements are now configured as <channel-adapter/>. That element requires exactly one of "source" or "target" and optionally accepts a "method" attribute for creating either a MethodInvokingSource or a MethodInvokingTarget (INT-277).
This commit is contained in:
@@ -16,20 +16,24 @@
|
||||
|
||||
package org.springframework.integration.channel.config;
|
||||
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.MessageSource;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class TestSourceBean {
|
||||
public class TestSource implements MessageSource<String> {
|
||||
|
||||
private final String text;
|
||||
|
||||
|
||||
public TestSourceBean(String text) {
|
||||
public TestSource(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return this.text;
|
||||
public Message<String> receive() {
|
||||
return new StringMessage(this.text);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,29 +31,29 @@
|
||||
</interceptors>
|
||||
</handler-endpoint>
|
||||
|
||||
<target-endpoint id="targetEndpointWithoutAdvice"
|
||||
input-channel="testChannel"
|
||||
target="testTarget">
|
||||
<channel-adapter id="targetEndpointWithoutAdvice"
|
||||
channel="testChannel"
|
||||
target="testTarget">
|
||||
<schedule period="100"/>
|
||||
</target-endpoint>
|
||||
</channel-adapter>
|
||||
|
||||
<target-endpoint id="targetEndpointWithAdvice"
|
||||
input-channel="testChannel"
|
||||
target="testTarget">
|
||||
<channel-adapter id="targetEndpointWithAdvice"
|
||||
channel="testChannel"
|
||||
target="testTarget">
|
||||
<schedule period="100"/>
|
||||
<interceptors>
|
||||
<ref bean="simpleAdvice"/>
|
||||
<ref bean="interceptor"/>
|
||||
</interceptors>
|
||||
</target-endpoint>
|
||||
</channel-adapter>
|
||||
|
||||
<source-endpoint id="sourceEndpointWithoutAdvice"
|
||||
<channel-adapter id="sourceEndpointWithoutAdvice"
|
||||
source="testSource"
|
||||
channel="replyChannel">
|
||||
<schedule period="100"/>
|
||||
</source-endpoint>
|
||||
</channel-adapter>
|
||||
|
||||
<source-endpoint id="sourceEndpointWithAdvice"
|
||||
<channel-adapter id="sourceEndpointWithAdvice"
|
||||
source="testSource"
|
||||
channel="testChannel">
|
||||
<schedule period="100"/>
|
||||
@@ -61,7 +61,7 @@
|
||||
<ref bean="simpleAdvice"/>
|
||||
<ref bean="interceptor"/>
|
||||
</interceptors>
|
||||
</source-endpoint>
|
||||
</channel-adapter>
|
||||
|
||||
<beans:bean id="testHandler" class="org.springframework.integration.config.TestHandler"/>
|
||||
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
|
||||
<direct-channel id="channelWithoutSource"/>
|
||||
|
||||
<direct-channel id="channelWithSource" source="source"/>
|
||||
<direct-channel id="channelWithSource" source="testSource"/>
|
||||
|
||||
<source-adapter id="source" ref="testSourceBean" method="getText"/>
|
||||
|
||||
<beans:bean id="testSourceBean" class="org.springframework.integration.channel.config.TestSourceBean">
|
||||
<beans:bean id="testSource" class="org.springframework.integration.channel.config.TestSource">
|
||||
<beans:constructor-arg value="foo"/>
|
||||
</beans:bean>
|
||||
|
||||
|
||||
@@ -11,13 +11,11 @@
|
||||
|
||||
<si:channel id="channel"/>
|
||||
|
||||
<si:source-endpoint source="sourceAdapter" channel="channel">
|
||||
<si:channel-adapter source="source" method="foo" channel="channel">
|
||||
<si:schedule period="100"/>
|
||||
</si:source-endpoint>
|
||||
</si:channel-adapter>
|
||||
|
||||
<si:target-endpoint target="sink" method="store" input-channel="channel"/>
|
||||
|
||||
<si:source-adapter id="sourceAdapter" ref="source" method="foo"/>
|
||||
<si:channel-adapter target="sink" method="store" channel="channel"/>
|
||||
|
||||
<bean id="source" class="org.springframework.integration.handler.TestSource"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user