diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java b/org.springframework.integration/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java index 6c43fdafad..4c8b5be27c 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java @@ -18,8 +18,6 @@ package org.springframework.integration.handler; import java.util.List; -import org.springframework.beans.BeanWrapperImpl; -import org.springframework.beans.PropertyAccessor; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanNameAware; @@ -28,6 +26,7 @@ import org.springframework.integration.channel.BeanFactoryChannelResolver; import org.springframework.integration.channel.ChannelResolver; import org.springframework.integration.core.Message; import org.springframework.integration.core.MessageChannel; +import org.springframework.integration.core.MessageProducer; import org.springframework.integration.filter.MessageFilter; import org.springframework.integration.message.MessageHandler; import org.springframework.integration.message.MessageHandlingException; @@ -37,11 +36,10 @@ import org.springframework.util.Assert; * A composite {@link MessageHandler} implementation that invokes a chain of * MessageHandler instances in order. *
- * Each of the handlers has to implement - *public void setOutputChannel(MessageChannel outputChannel);. An
- * exception is made for the last handler in the case that the chain itself does
- * not have an output channel. No other assumptions about the type of handler
- * are made.
+ * Each of the handlers except for the last one must implement the
+ * {@link MessageProducer} interface. The last handler must also if
+ * the chain itself has an output channel configured. No other assumptions
+ * are made about the type of handler.
*
* It is expected that each handler will produce reply messages and send them to
* its output channel, although this is not enforced. It is possible to filter
@@ -65,9 +63,7 @@ import org.springframework.util.Assert;
* @author Mark Fisher
* @author Iwein Fuld
*/
-public class MessageHandlerChain implements MessageHandler, Ordered, BeanFactoryAware, BeanNameAware {
-
- private static final String OUTPUT_CHANNEL_PROPERTY = "outputChannel";
+public class MessageHandlerChain implements MessageHandler, MessageProducer, Ordered, BeanFactoryAware, BeanNameAware {
private volatile List