diff --git a/org.springframework.integration.jms/src/main/java/org/springframework/integration/jms/JmsSendingMessageHandler.java b/org.springframework.integration.jms/src/main/java/org/springframework/integration/jms/JmsSendingMessageHandler.java
index bb1ed14524..cb0f45f901 100644
--- a/org.springframework.integration.jms/src/main/java/org/springframework/integration/jms/JmsSendingMessageHandler.java
+++ b/org.springframework.integration.jms/src/main/java/org/springframework/integration/jms/JmsSendingMessageHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * 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.
@@ -16,6 +16,7 @@
package org.springframework.integration.jms;
+import org.springframework.core.Ordered;
import org.springframework.integration.core.Message;
import org.springframework.integration.message.MessageHandler;
import org.springframework.jms.core.JmsTemplate;
@@ -27,10 +28,12 @@ import org.springframework.jms.support.converter.MessageConverter;
*
* @author Mark Fisher
*/
-public class JmsSendingMessageHandler extends AbstractJmsTemplateBasedAdapter implements MessageHandler {
+public class JmsSendingMessageHandler extends AbstractJmsTemplateBasedAdapter implements MessageHandler, Ordered {
private volatile boolean extractPayload = true;
+ private volatile int order = Ordered.LOWEST_PRECEDENCE;
+
/**
* Specify whether the payload should be extracted from each Spring
@@ -44,6 +47,14 @@ public class JmsSendingMessageHandler extends AbstractJmsTemplateBasedAdapter im
this.extractPayload = extractPayload;
}
+ public void setOrder(int order) {
+ this.order = order;
+ }
+
+ public int getOrder() {
+ return this.order;
+ }
+
public final void handleMessage(final Message> message) {
if (message == null) {
throw new IllegalArgumentException("message must not be null");
diff --git a/org.springframework.integration.jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-1.0.xsd b/org.springframework.integration.jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-1.0.xsd
index b835aefe6a..f1b45b2a86 100644
--- a/org.springframework.integration.jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-1.0.xsd
+++ b/org.springframework.integration.jms/src/main/resources/org/springframework/integration/jms/config/spring-integration-jms-1.0.xsd
@@ -314,6 +314,14 @@
+
+
+
+
+
@@ -367,6 +375,14 @@
+
+
+
+
+
diff --git a/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundChannelAdapterParserTests.java b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundChannelAdapterParserTests.java
index faee14af00..11900e3f9d 100644
--- a/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundChannelAdapterParserTests.java
+++ b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundChannelAdapterParserTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * 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.
@@ -63,6 +63,17 @@ public class JmsOutboundChannelAdapterParserTests {
assertNotNull(accessor.getPropertyValue("jmsTemplate"));
}
+ @Test
+ public void adapterWithOrder() {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ "jmsOutboundWithOrder.xml", this.getClass());
+ EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("adapter");
+ DirectFieldAccessor accessor = new DirectFieldAccessor(
+ new DirectFieldAccessor(endpoint).getPropertyValue("handler"));
+ Object order = accessor.getPropertyValue("order");
+ assertEquals(123, order);
+ }
+
@Test
public void adapterWithHeaderMapper() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
diff --git a/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java
index 075e1c08ae..c19755b0cf 100644
--- a/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java
+++ b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * 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.
@@ -15,11 +15,13 @@
*/
package org.springframework.integration.jms.config;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.jms.JmsOutboundGateway;
import org.springframework.integration.jms.StubMessageConverter;
@@ -42,4 +44,15 @@ public class JmsOutboundGatewayParserTests {
assertTrue("Wrong message converter", converter instanceof StubMessageConverter);
}
+ @Test
+ public void gatewayWithOrder() {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ "jmsOutboundGatewayWithOrder.xml", this.getClass());
+ EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("jmsGateway");
+ DirectFieldAccessor accessor = new DirectFieldAccessor(
+ new DirectFieldAccessor(endpoint).getPropertyValue("handler"));
+ Object order = accessor.getPropertyValue("order");
+ assertEquals(99, order);
+ }
+
}
diff --git a/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/jmsOutboundGatewayWithOrder.xml b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/jmsOutboundGatewayWithOrder.xml
new file mode 100644
index 0000000000..a6763466a2
--- /dev/null
+++ b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/jmsOutboundGatewayWithOrder.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/jmsOutboundWithOrder.xml b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/jmsOutboundWithOrder.xml
new file mode 100644
index 0000000000..cab3f2dd32
--- /dev/null
+++ b/org.springframework.integration.jms/src/test/java/org/springframework/integration/jms/config/jmsOutboundWithOrder.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+