{
+public interface MessageMapper message);
+ Message> toMessage(T object);
+
+ T fromMessage(Message> message);
}
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java
deleted file mode 100644
index 58882e54f4..0000000000
--- a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2002-2008 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.gateway;
-
-import org.springframework.integration.channel.MessageChannel;
-import org.springframework.integration.channel.MessageChannelTemplate;
-
-/**
- * A convenient base class providing access to a {@link MessageChannelTemplate} and exposing setter methods for
- * configuring request and reply {@link MessageChannel MessageChannels}. May be used as a base class for framework
- * components so that the details of messaging are well-encapsulated and hidden from application code. For example,
- * see {@link SimpleMessagingGateway}.
- *
- * @author Mark Fisher
- */
-public abstract class MessagingGatewaySupport {
-
- private final MessageChannelTemplate channelTemplate = new MessageChannelTemplate();
-
-
- /**
- * Set the timeout value for sending request messages. If not
- * explicitly configured, the default is an indefinite timeout.
- *
- * @param requestTimeout the timeout value in milliseconds
- */
- public void setRequestTimeout(long requestTimeout) {
- this.channelTemplate.setSendTimeout(requestTimeout);
- }
-
- /**
- * Set the timeout value for receiving reply messages. If not
- * explicitly configured, the default is an indefinite timeout.
- *
- * @param replyTimeout the timeout value in milliseconds
- */
- public void setReplyTimeout(long replyTimeout) {
- this.channelTemplate.setReceiveTimeout(replyTimeout);
- }
-
- /**
- * Retrieve the {@link MessageChannelTemplate} for performing
- * send and receive operations across channels.
- */
- protected final MessageChannelTemplate getChannelTemplate() {
- return this.channelTemplate;
- }
-
-}
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/SimpleMessagingGateway.java b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/SimpleMessagingGateway.java
index 0029143c3c..9040e5ffc1 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/SimpleMessagingGateway.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/SimpleMessagingGateway.java
@@ -21,34 +21,37 @@ import org.springframework.integration.ConfigurationException;
import org.springframework.integration.bus.MessageBus;
import org.springframework.integration.bus.MessageBusAware;
import org.springframework.integration.channel.MessageChannel;
+import org.springframework.integration.channel.MessageChannelTemplate;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.endpoint.MessagingGateway;
-import org.springframework.integration.message.DefaultMessageCreator;
-import org.springframework.integration.message.DefaultMessageMapper;
import org.springframework.integration.message.Message;
-import org.springframework.integration.message.MessageCreator;
import org.springframework.integration.message.MessageDeliveryException;
-import org.springframework.integration.message.MessageMapper;
import org.springframework.util.Assert;
/**
- * A general purpose class that supports a variety of message exchanges. Useful for connecting application code to
- * {@link MessageChannel MessageChannels} for sending, receiving, or request-reply operations. The sending methods
- * accept any Object as the parameter value (i.e. it is not required to be a Message). A custom {@link MessageCreator}
- * may be provided for creating Messages from the Objects. Likewise return values may be any Object and a custom
- * implementation of the {@link MessageMapper} strategy may be provided for mapping a reply Message to an Object.
+ * A convenient base class for connecting application code to
+ * {@link MessageChannel}s for sending, receiving, or request-reply operations.
+ * Exposes setters for configuring request and reply {@link MessageChannel}s as
+ * well as the timeout values for sending and receiving Messages.
+ *
+ * By default, each request Message will be created with the method
+ * parameter as its payload, and each reply Message's payload will be the
+ * return value. To provide custom behavior for object-to-request and/or
+ * reply-to-object conversion, implement and set a 'messageMapper'.
+ *
+ * @see MessageMapper
*
* @author Mark Fisher
*/
-public class SimpleMessagingGateway extends MessagingGatewaySupport implements MessagingGateway, MessageBusAware, InitializingBean {
+public class SimpleMessagingGateway implements MessagingGateway, MessageBusAware, InitializingBean {
private volatile MessageChannel requestChannel;
private volatile MessageChannel replyChannel;
- private volatile MessageCreator messageCreator = new DefaultMessageCreator();
+ private volatile MessageMapper messageMapper = new DefaultMessageMapper