diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-4.1.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-4.1.xsd index a6dd4c7fb4..73f8e537c3 100644 --- a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-4.1.xsd +++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-4.1.xsd @@ -3322,7 +3322,9 @@ Set this flag to false to prevent adding sequence related headers in this splitter. This can be convenient in cases where the set sequence numbers conflict with downstream - custom aggregations. + custom aggregations. When true, existing correlation and sequence related headers + are pushed onto a stack; downstream components, such as aggregators may pop + the stack to revert the existing headers after aggregation. Default is 'true'. diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/config/XPathMessageSplitterParser.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/config/XPathMessageSplitterParser.java index 3adcc9eb17..f5ca2653cc 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/config/XPathMessageSplitterParser.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/config/XPathMessageSplitterParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -30,6 +30,7 @@ import org.springframework.util.StringUtils; /** * @author Jonas Partner + * @author Artem Bilan */ public class XPathMessageSplitterParser extends AbstractConsumerEndpointParser { @@ -53,6 +54,7 @@ public class XPathMessageSplitterParser extends AbstractConsumerEndpointParser { } IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "doc-builder-factory", "documentBuilder"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "create-documents"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "apply-sequence"); return builder; } diff --git a/spring-integration-xml/src/main/resources/org/springframework/integration/xml/config/spring-integration-xml-4.1.xsd b/spring-integration-xml/src/main/resources/org/springframework/integration/xml/config/spring-integration-xml-4.1.xsd index 07149ab7c4..05e39c7a3a 100644 --- a/spring-integration-xml/src/main/resources/org/springframework/integration/xml/config/spring-integration-xml-4.1.xsd +++ b/spring-integration-xml/src/main/resources/org/springframework/integration/xml/config/spring-integration-xml-4.1.xsd @@ -742,7 +742,31 @@ - + + + + Set this flag to 'true' to convert each resuling Node to a Document + before sending replies from this splitter. Default is 'false' + + + + + + + + + + Set this flag to false to prevent adding sequence related headers in this splitter. + This can be convenient in cases where the set sequence numbers conflict with downstream + custom aggregations. When true, existing correlation and sequence related headers + are pushed onto a stack; downstream components, such as aggregators may pop + the stack to revert the existing headers after aggregation. Default is 'true'. + + + + + + diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests-context.xml b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests-context.xml new file mode 100644 index 0000000000..04b69aaa50 --- /dev/null +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests-context.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests.java new file mode 100644 index 0000000000..49f6e15f01 --- /dev/null +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests.java @@ -0,0 +1,52 @@ +/* + * Copyright 2014 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.xml.config; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.integration.test.util.TestUtils; +import org.springframework.messaging.MessageHandler; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Artem Bilan + */ +@ContextConfiguration +@RunWith(SpringJUnit4ClassRunner.class) +public class XPathSplitterParserTests { + + @Autowired @Qualifier("xpathSplitter.handler") + private MessageHandler xpathSplitter; + + @Test + public void testXpathSplitterConfig() { + assertTrue(TestUtils.getPropertyValue(this.xpathSplitter, "createDocuments", Boolean.class)); + assertFalse(TestUtils.getPropertyValue(this.xpathSplitter, "applySequence", Boolean.class)); + assertEquals("/orders/order", + TestUtils.getPropertyValue(this.xpathSplitter, + "xpathExpression.xpathExpression.xpath.m_patternString", + String.class)); + } + +}