INT-697, added namespace support for RecipientListRouter
This commit is contained in:
@@ -82,6 +82,7 @@ public class IntegrationNamespaceHandler implements NamespaceHandler {
|
||||
registerBeanDefinitionParser("router", new DefaultRouterParser());
|
||||
registerBeanDefinitionParser("header-value-router", new HeaderValueRouterParser());
|
||||
registerBeanDefinitionParser("payload-type-router", new PayloadTypeRouterParser());
|
||||
registerBeanDefinitionParser("recipient-list-router", new RecipientListRouterParser());
|
||||
registerBeanDefinitionParser("splitter", new SplitterParser());
|
||||
registerBeanDefinitionParser("aggregator", new AggregatorParser());
|
||||
registerBeanDefinitionParser("resequencer", new ResequencerParser());
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.config.xml;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for the <recipient-list-router/> element.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 1.0.3
|
||||
*/
|
||||
public class RecipientListRouterParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
@Override
|
||||
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder recipientListRouterBuilder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
IntegrationNamespaceUtils.BASE_PACKAGE + ".router.RecipientListRouter");
|
||||
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "recipient");
|
||||
Assert.notEmpty(childElements,
|
||||
"Recipient channel(s) must be defined (e.g., <recipient channel=\"channel1\"/>)");
|
||||
|
||||
ManagedList channelList = new ManagedList();
|
||||
for (Element childElement : childElements) {
|
||||
channelList.add(new RuntimeBeanReference(childElement.getAttribute("channel")));
|
||||
}
|
||||
recipientListRouterBuilder.addPropertyValue("channels", channelList);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(recipientListRouterBuilder, element, "timeout");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(recipientListRouterBuilder, element, "ignore-send-failures");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(recipientListRouterBuilder, element, "apply-sequence");
|
||||
return recipientListRouterBuilder;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -883,6 +883,27 @@
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="recipient-list-router">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines a Recipient List Router.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="routerType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="recipient" minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="channel" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="payload-type-router">
|
||||
<xsd:annotation>
|
||||
|
||||
Reference in New Issue
Block a user