The <inbound-channel-adapter/> and <outbound-channel-adapter/> elements now expect the "ref" attribute (instead of "source" for inbound and "target" for outbound).
This commit is contained in:
@@ -34,17 +34,17 @@ public class MethodInvokingInboundChannelAdapterParser extends AbstractPollingIn
|
||||
|
||||
@Override
|
||||
protected String parseSource(Element element, ParserContext parserContext) {
|
||||
String source = element.getAttribute("source");
|
||||
Assert.hasText(source, "The 'source' attribute is required.");
|
||||
String sourceRef = element.getAttribute("ref");
|
||||
Assert.hasText(sourceRef, "The 'ref' attribute is required.");
|
||||
String methodName = element.getAttribute("method");
|
||||
if (StringUtils.hasText(methodName)) {
|
||||
BeanDefinitionBuilder invokerBuilder = BeanDefinitionBuilder.genericBeanDefinition(MethodInvokingSource.class);
|
||||
invokerBuilder.addPropertyReference("object", source);
|
||||
invokerBuilder.addPropertyReference("object", sourceRef);
|
||||
invokerBuilder.addPropertyValue("methodName", methodName);
|
||||
source = BeanDefinitionReaderUtils.registerWithGeneratedName(
|
||||
sourceRef = BeanDefinitionReaderUtils.registerWithGeneratedName(
|
||||
invokerBuilder.getBeanDefinition(), parserContext.getRegistry());
|
||||
}
|
||||
return source;
|
||||
return sourceRef;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,19 +35,19 @@ public class MethodInvokingOutboundChannelAdapterParser extends AbstractOutbound
|
||||
|
||||
@Override
|
||||
protected String parseAndRegisterConsumer(Element element, ParserContext parserContext) {
|
||||
String target = element.getAttribute("target");
|
||||
Assert.isTrue(StringUtils.hasText(target), "target is required");
|
||||
String consumerRef = element.getAttribute("ref");
|
||||
Assert.isTrue(StringUtils.hasText(consumerRef), "The 'ref' attribute is required.");
|
||||
if (element.hasAttribute("method")) {
|
||||
target = BeanDefinitionReaderUtils.registerWithGeneratedName(
|
||||
consumerRef = BeanDefinitionReaderUtils.registerWithGeneratedName(
|
||||
this.parseConsumer(element, parserContext), parserContext.getRegistry());
|
||||
}
|
||||
return target;
|
||||
return consumerRef;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder invokerBuilder = BeanDefinitionBuilder.genericBeanDefinition(MethodInvokingConsumer.class);
|
||||
invokerBuilder.addConstructorArgReference(element.getAttribute("target"));
|
||||
invokerBuilder.addConstructorArgReference(element.getAttribute("ref"));
|
||||
invokerBuilder.addConstructorArgValue(element.getAttribute("method"));
|
||||
return invokerBuilder.getBeanDefinition();
|
||||
}
|
||||
|
||||
@@ -163,40 +163,32 @@
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="inbound-channel-adapter">
|
||||
<xsd:complexType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<xsd:element name="inbound-channel-adapter" type="channelAdapterType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Defines a Channel Adapter that receives from a MessageSource and sends to a MessageChannel.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="poller" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:ID"/>
|
||||
<xsd:attribute name="channel" type="xsd:string"/>
|
||||
<xsd:attribute name="source" type="xsd:string"/>
|
||||
<xsd:attribute name="method" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="outbound-channel-adapter">
|
||||
<xsd:complexType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<xsd:element name="outbound-channel-adapter" type="channelAdapterType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Defines a Channel Adapter that receives from a MessageChannel and sends to a MessageConsumer.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="poller" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:ID"/>
|
||||
<xsd:attribute name="channel" type="xsd:string"/>
|
||||
<xsd:attribute name="target" type="xsd:string"/>
|
||||
<xsd:attribute name="method" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="channelAdapterType">
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="poller" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:ID"/>
|
||||
<xsd:attribute name="channel" type="xsd:string"/>
|
||||
<xsd:attribute name="ref" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="method" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="service-activator" type="inputOutputEndpointType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
<queue capacity="10"/>
|
||||
</channel>
|
||||
|
||||
<outbound-channel-adapter id="outboundWithImplicitChannel" target="consumer"/>
|
||||
<outbound-channel-adapter id="outboundWithImplicitChannel" ref="consumer"/>
|
||||
|
||||
<outbound-channel-adapter id="methodInvokingConsumer" target="testBean" method="store"/>
|
||||
<outbound-channel-adapter id="methodInvokingConsumer" ref="testBean" method="store"/>
|
||||
|
||||
<inbound-channel-adapter id="methodInvokingSource" source="testBean" method="getMessage" channel="queueChannel">
|
||||
<inbound-channel-adapter id="methodInvokingSource" ref="testBean" method="getMessage" channel="queueChannel">
|
||||
<poller period="10000" max-messages-per-poll="1"/>
|
||||
</inbound-channel-adapter>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user