diff --git a/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.0.xsd b/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.0.xsd
index 7f76faf778..74de95b463 100644
--- a/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.0.xsd
+++ b/spring-integration-ip/src/main/resources/org/springframework/integration/ip/config/spring-integration-ip-2.0.xsd
@@ -100,6 +100,14 @@ task executors such as a WorkManagerTaskExecutor.
+
+
+
+ Specifies the order for invocation when this endpoint is connected as a
+ subscriber to a SubscribableChannel.
+
+
+
@@ -176,6 +184,14 @@ inbound message was received.
+
+
+
+ Specifies the order for invocation when this endpoint is connected as a
+ subscriber to a SubscribableChannel.
+
+
+
@@ -268,6 +284,14 @@ A connection factory is needed by an outbound adapter. The connection factory mu
+
+
+
+ Specifies the order for invocation when this endpoint is connected as a
+ subscriber to a SubscribableChannel.
+
+
+
diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests-context.xml b/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests-context.xml
index 8dc22a1919..64e0efbe6c 100644
--- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests-context.xml
+++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests-context.xml
@@ -73,7 +73,8 @@
so-send-buffer-size="53"
so-timeout="54"
local-address="127.0.0.1"
- task-executor="externalTE"
+ task-executor="externalTE"
+ order="23"
/>
+ connection-factory="client1"
+ order="25"/>
+ connection-factory="server1"
+ order="15"/>
deserializer;
@Autowired
- @Qualifier(value="server1")
AbstractConnectionFactory server1;
@Autowired
- @Qualifier(value="server2")
AbstractConnectionFactory server2;
@Autowired
- @Qualifier(value="cfS1")
AbstractConnectionFactory cfS1;
@Autowired
- @Qualifier(value="cfS2")
AbstractConnectionFactory cfS2;
@Autowired
- @Qualifier(value="cfS3")
AbstractConnectionFactory cfS3;
@Autowired
@@ -154,16 +151,19 @@ public class ParserUnitTests {
TcpSendingMessageHandler tcpNewOut2;
@Autowired
- @Qualifier(value="tcpNewIn1")
TcpReceivingChannelAdapter tcpNewIn1;
@Autowired
- @Qualifier(value="tcpNewIn2")
TcpReceivingChannelAdapter tcpNewIn2;
@Autowired
- @Qualifier("errorChannel")
private MessageChannel errorChannel;
+
+ @Autowired
+ private DirectChannel udpChannel;
+
+ @Autowired
+ private DirectChannel tcpChannel;
@Test
public void testInUdp() {
@@ -231,6 +231,7 @@ public class ParserUnitTests {
assertEquals(54, dfa.getPropertyValue("soTimeout"));
assertEquals("127.0.0.1", dfa.getPropertyValue("localAddress"));
assertSame(taskExecutor, dfa.getPropertyValue("taskExecutor"));
+ assertEquals(23, dfa.getPropertyValue("order"));
assertEquals("testOutUdp",udpOut.getComponentName());
assertEquals("ip:udp-outbound-channel-adapter", udpOut.getComponentType());
}
@@ -253,6 +254,19 @@ public class ParserUnitTests {
assertEquals(53, dfa.getPropertyValue("soSendBufferSize"));
assertEquals(54, dfa.getPropertyValue("soTimeout"));
assertEquals(55, dfa.getPropertyValue("timeToLive"));
+ assertEquals(12, dfa.getPropertyValue("order"));
+ }
+
+ @Test
+ public void testUdpOrder() {
+ @SuppressWarnings("unchecked")
+ Set handlers = (Set) TestUtils
+ .getPropertyValue(
+ TestUtils.getPropertyValue(this.udpChannel, "dispatcher"),
+ "handlers");
+ Iterator iterator = handlers.iterator();
+ assertSame(this.udpOutMulticast, iterator.next());
+ assertSame(this.udpOut, iterator.next());
}
@Test
@@ -262,6 +276,7 @@ public class ParserUnitTests {
assertEquals("testOutTcpNio",tcpOut.getComponentName());
assertEquals("ip:tcp-outbound-channel-adapter", tcpOut.getComponentType());
assertFalse(cfC1.isLookupHost());
+ assertEquals(35, dfa.getPropertyValue("order"));
}
@Test
@@ -294,6 +309,7 @@ public class ParserUnitTests {
assertEquals("outGateway",tcpOutboundGateway.getComponentName());
assertEquals("ip:tcp-outbound-gateway", tcpOutboundGateway.getComponentType());
assertTrue(cfC2.isLookupHost());
+ assertEquals(24, dfa.getPropertyValue("order"));
}
@Test
@@ -380,12 +396,14 @@ public class ParserUnitTests {
public void testNewOut1() {
DirectFieldAccessor dfa = new DirectFieldAccessor(tcpNewOut1);
assertSame(client1, dfa.getPropertyValue("clientConnectionFactory"));
+ assertEquals(25, dfa.getPropertyValue("order"));
}
@Test
public void testNewOut2() {
DirectFieldAccessor dfa = new DirectFieldAccessor(tcpNewOut2);
assertSame(server1, dfa.getPropertyValue("serverConnectionFactory"));
+ assertEquals(15, dfa.getPropertyValue("order"));
}
@Test
@@ -401,4 +419,18 @@ public class ParserUnitTests {
assertSame(server1, dfa.getPropertyValue("serverConnectionFactory"));
}
+ @Test
+ public void testtCPOrder() {
+ @SuppressWarnings("unchecked")
+ Set handlers = (Set) TestUtils
+ .getPropertyValue(
+ TestUtils.getPropertyValue(this.tcpChannel, "dispatcher"),
+ "handlers");
+ Iterator iterator = handlers.iterator();
+ assertSame(this.tcpNewOut2, iterator.next()); //15
+ assertSame(this.tcpOutboundGateway, iterator.next()); //24
+ assertSame(this.tcpNewOut1, iterator.next()); //25
+ assertSame(this.tcpOut, iterator.next()); //35
+ }
+
}
diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.0.xsd b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.0.xsd
index 1d124bdf8a..59dea96f31 100644
--- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.0.xsd
+++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.0.xsd
@@ -302,6 +302,14 @@
+
+
+
+ Specifies the order for invocation when this endpoint is connected as a
+ subscriber to a SubscribableChannel.
+
+
+
@@ -425,6 +433,14 @@
+
+
+
+ Specifies the order for invocation when this endpoint is connected as a
+ subscriber to a SubscribableChannel.
+
+
+
diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java
index 43043ede4a..dd49f52072 100644
--- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java
+++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageHandlerParserTests.java
@@ -1,3 +1,16 @@
+/*
+ * Copyright 2002-2011 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.jdbc.config;
import static junit.framework.Assert.assertTrue;
@@ -10,16 +23,25 @@ import javax.sql.DataSource;
import org.junit.After;
import org.junit.Test;
-
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
+import org.springframework.integration.jdbc.JdbcMessageHandler;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.test.util.TestUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+/**
+ * @author Dave Syer
+ * @author Mark Fisher
+ * @author Oleg Zhurakousky
+ * @author Gary Russell
+ * @since 2.0
+ *
+ */
public class JdbcMessageHandlerParserTests {
private SimpleJdbcTemplate jdbcTemplate;
@@ -36,6 +58,8 @@ public class JdbcMessageHandlerParserTests {
Map map = this.jdbcTemplate.queryForMap("SELECT * from FOOS");
assertEquals("Wrong id", "FOO", map.get("ID"));
assertEquals("Wrong id", "foo", map.get("name"));
+ JdbcMessageHandler handler = context.getBean(JdbcMessageHandler.class);
+ assertEquals(23, TestUtils.getPropertyValue(handler, "order"));
}
@Test
diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java
index 5e9c013464..917a74a4b5 100644
--- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java
+++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcOutboundGatewayParserTests.java
@@ -1,3 +1,15 @@
+/*
+ * Copyright 2002-2011 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.jdbc.config;
import static junit.framework.Assert.assertTrue;
@@ -19,10 +31,19 @@ import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.core.PollableChannel;
+import org.springframework.integration.jdbc.JdbcOutboundGateway;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.test.util.TestUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+/**
+ * @author Dave Syer
+ * @author Oleg Zhurakousky
+ * @author Gary Russell
+ * @since 2.0
+ *
+ */
public class JdbcOutboundGatewayParserTests {
private SimpleJdbcTemplate jdbcTemplate;
@@ -47,6 +68,8 @@ public class JdbcOutboundGatewayParserTests {
@SuppressWarnings("unchecked")
Map payload = (Map) reply.getPayload();
assertEquals("bar", payload.get("name"));
+ JdbcOutboundGateway gateway = context.getBean(JdbcOutboundGateway.class);
+ assertEquals(23, TestUtils.getPropertyValue(gateway, "order"));
}
@Test
diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/handlingMapPayloadJdbcOutboundGatewayTest.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/handlingMapPayloadJdbcOutboundGatewayTest.xml
index 6480d4b076..cce15758cb 100644
--- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/handlingMapPayloadJdbcOutboundGatewayTest.xml
+++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/handlingMapPayloadJdbcOutboundGatewayTest.xml
@@ -14,7 +14,7 @@
+ request-channel="target" reply-channel="output" data-source="dataSource" order="23"/>
diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/handlingWithJdbcOperationsJdbcOutboundChannelAdapterTest.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/handlingWithJdbcOperationsJdbcOutboundChannelAdapterTest.xml
index 29ea1c5212..f0003c908d 100644
--- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/handlingWithJdbcOperationsJdbcOutboundChannelAdapterTest.xml
+++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/handlingWithJdbcOperationsJdbcOutboundChannelAdapterTest.xml
@@ -10,7 +10,7 @@
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
+ channel="target" jdbc-operations="jdbcTemplate" order="23"/>