diff --git a/spring-integration-adapters/src/main/java/META-INF/spring-integration.parsers b/spring-integration-adapters/src/main/java/META-INF/spring-integration.parsers
index ac1e1f6beb..d282842c05 100644
--- a/spring-integration-adapters/src/main/java/META-INF/spring-integration.parsers
+++ b/spring-integration-adapters/src/main/java/META-INF/spring-integration.parsers
@@ -7,6 +7,7 @@ httpinvoker-source=org.springframework.integration.adapter.httpinvoker.config.Ht
httpinvoker-target=org.springframework.integration.adapter.httpinvoker.config.HttpInvokerTargetAdapterParser
jms-source=org.springframework.integration.adapter.jms.config.JmsSourceAdapterParser
jms-target=org.springframework.integration.adapter.jms.config.JmsTargetParser
+jms-gateway=org.springframework.integration.adapter.jms.config.JmsGatewayParser
mail-target=org.springframework.integration.adapter.mail.config.MailTargetParser
rmi-source=org.springframework.integration.adapter.rmi.config.RmiSourceAdapterParser
rmi-target=org.springframework.integration.adapter.rmi.config.RmiTargetAdapterParser
\ No newline at end of file
diff --git a/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/MessageHandlingSourceAdapter.java b/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/MessageHandlingSourceAdapter.java
index 4b9dbc34d3..8edd41db2b 100644
--- a/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/MessageHandlingSourceAdapter.java
+++ b/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/MessageHandlingSourceAdapter.java
@@ -37,16 +37,12 @@ public class MessageHandlingSourceAdapter implements MessageHandler, Initializin
private final Log logger = LogFactory.getLog(this.getClass());
- private final MessageChannel channel;
+ private final MessageChannel requestChannel;
- private volatile RequestReplyTemplate requestReplyTemplate;
+ private final RequestReplyTemplate requestReplyTemplate = new RequestReplyTemplate();
private volatile boolean expectReply = true;
- private volatile long sendTimeout = -1;
-
- private volatile long receiveTimeout = -1;
-
protected final Object lifecycleMonitor = new Object();
private volatile boolean initialized;
@@ -55,12 +51,13 @@ public class MessageHandlingSourceAdapter implements MessageHandler, Initializin
/**
* Create an adapter that sends to the provided channel.
*
- * @param channel the channel where messages will be sent, must not be
+ * @param requestChannel the channel where messages will be sent, must not be
* null.
*/
- public MessageHandlingSourceAdapter(MessageChannel channel) {
- Assert.notNull(channel, "channel must not be null");
- this.channel = channel;
+ public MessageHandlingSourceAdapter(MessageChannel requestChannel) {
+ Assert.notNull(requestChannel, "request channel must not be null");
+ this.requestChannel = requestChannel;
+ this.requestReplyTemplate.setRequestChannel(requestChannel);
}
@@ -72,16 +69,16 @@ public class MessageHandlingSourceAdapter implements MessageHandler, Initializin
this.expectReply = expectReply;
}
- public void setSendTimeout(long sendTimeout) {
- this.sendTimeout = sendTimeout;
+ public void setRequestTimeout(long requestTimeout) {
+ this.requestReplyTemplate.setRequestTimeout(requestTimeout);
}
- public void setReceiveTimeout(long receiveTimeout) {
- this.receiveTimeout = receiveTimeout;
+ public void setReplyTimeout(long replyTimeout) {
+ this.requestReplyTemplate.setReplyTimeout(replyTimeout);
}
protected MessageChannel getChannel() {
- return this.channel;
+ return this.requestChannel;
}
public final void afterPropertiesSet() throws Exception {
@@ -89,9 +86,6 @@ public class MessageHandlingSourceAdapter implements MessageHandler, Initializin
if (this.initialized) {
return;
}
- if (this.requestReplyTemplate == null) {
- this.requestReplyTemplate = this.createRequestReplyTemplate();
- }
}
this.initialize();
this.initialized = true;
@@ -103,13 +97,6 @@ public class MessageHandlingSourceAdapter implements MessageHandler, Initializin
protected void initialize() throws Exception {
}
- private RequestReplyTemplate createRequestReplyTemplate() {
- RequestReplyTemplate template = new RequestReplyTemplate(this.channel);
- template.setRequestTimeout(this.sendTimeout);
- template.setReplyTimeout(this.receiveTimeout);
- return template;
- }
-
public final Message> handle(Message> message) {
if (!this.initialized) {
try {
@@ -120,9 +107,9 @@ public class MessageHandlingSourceAdapter implements MessageHandler, Initializin
}
}
if (!this.expectReply) {
- boolean sent = (this.sendTimeout < 0) ? this.channel.send(message) : this.channel.send(message, this.sendTimeout);
+ boolean sent = this.requestReplyTemplate.send(message);
if (!sent && logger.isWarnEnabled()) {
- logger.warn("failed to send message to channel within timeout of " + this.sendTimeout + " milliseconds");
+ logger.warn("failed to send message to channel within timeout");
}
return null;
}
diff --git a/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/config/AbstractRequestReplySourceAdapterParser.java b/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/config/AbstractRequestReplySourceAdapterParser.java
index efab9e8cc6..df122c7437 100644
--- a/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/config/AbstractRequestReplySourceAdapterParser.java
+++ b/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/config/AbstractRequestReplySourceAdapterParser.java
@@ -50,24 +50,24 @@ public abstract class AbstractRequestReplySourceAdapterParser extends AbstractSi
@Override
protected boolean isEligibleAttribute(String attributeName) {
- return !attributeName.equals("name") && !attributeName.equals("channel") && super.isEligibleAttribute(attributeName);
+ return !attributeName.equals("name") && !attributeName.equals("request-channel") && super.isEligibleAttribute(attributeName);
}
@Override
protected void postProcess(BeanDefinitionBuilder builder, Element element) {
- String channelRef = element.getAttribute("channel");
+ String channelRef = element.getAttribute("request-channel");
if (!StringUtils.hasText(channelRef)) {
- throw new ConfigurationException("a 'channel' reference is required");
+ throw new ConfigurationException("a 'request-channel' reference is required");
}
builder.addConstructorArgReference(channelRef);
builder.addPropertyValue("expectReply", element.getAttribute("expect-reply").equals("true"));
- String sendTimeout = element.getAttribute("send-timeout");
- if (StringUtils.hasText(sendTimeout)) {
- builder.addPropertyValue("sendTimeout", Long.parseLong(sendTimeout));
+ String requestTimeout = element.getAttribute("request-timeout");
+ if (StringUtils.hasText(requestTimeout)) {
+ builder.addPropertyValue("requestTimeout", Long.parseLong(requestTimeout));
}
- String receiveTimeout = element.getAttribute("receive-timeout");
- if (StringUtils.hasText(receiveTimeout)) {
- builder.addPropertyValue("receiveTimeout", Long.parseLong(receiveTimeout));
+ String replyTimeout = element.getAttribute("reply-timeout");
+ if (StringUtils.hasText(replyTimeout)) {
+ builder.addPropertyValue("replyTimeout", Long.parseLong(replyTimeout));
}
this.doPostProcess(builder, element);
}
diff --git a/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/config/spring-integration-adapters-1.0.xsd b/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/config/spring-integration-adapters-1.0.xsd
index 6cab322f6d..a0cb69d78d 100644
--- a/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/config/spring-integration-adapters-1.0.xsd
+++ b/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/config/spring-integration-adapters-1.0.xsd
@@ -58,54 +58,83 @@
-
+
+
+
+ Defines a JMS-based source channel adapter.
+
+
+
+
+
+
+
+ Defines a JMS-based gateway adapter.
+
+
-
-
- Defines a jms-based source channel adapter.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
Defines a target that sends JMS Messages.
-
-
-
-
-
-
-
-
+
+
+
+
+
+ Common configuration for inbound JMS-based adapters.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Common configuration for JMS-based adapters.
+
+
+
+
+
+
+
+
+
@@ -114,7 +143,7 @@
-
+
@@ -138,7 +167,7 @@
-
+
Defines an httpinvoker-based source channel adapter.
@@ -201,18 +230,19 @@
-
+
- Defines common configuration for request-reply source adapters.
+ Defines common configuration for gateway adapters.
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/file/FileSource.java b/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/file/FileSource.java
index c2d5a25163..c1dcf6a565 100644
--- a/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/file/FileSource.java
+++ b/spring-integration-adapters/src/main/java/org/springframework/integration/adapter/file/FileSource.java
@@ -23,7 +23,7 @@ import java.io.FilenameFilter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessagingException;
-import org.springframework.integration.message.PollableSource;
+import org.springframework.integration.message.Source;
import org.springframework.util.Assert;
/**
@@ -31,7 +31,7 @@ import org.springframework.util.Assert;
*
* @author Mark Fisher
*/
-public class FileSource implements PollableSource