This commit is contained in:
Mark Fisher
2009-03-12 16:35:09 +00:00
parent 02d49417e4
commit efd3f5848e
3 changed files with 88 additions and 3 deletions

View File

@@ -59,7 +59,6 @@
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="channelType">
<xsd:sequence>
@@ -422,7 +421,7 @@
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="bridge" type="inputOutputEndpointType">
<xsd:element name="bridge">
<xsd:annotation>
<xsd:documentation>
Defines an endpoint that passes a Message to the
@@ -430,6 +429,22 @@
modifying it.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="inputEndpointType">
<xsd:attribute name="output-channel" type="xsd:string" use="required">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type
type="org.springframework.integration.core.MessageChannel" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="chain">

View File

@@ -16,7 +16,9 @@
package org.springframework.integration.handler;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.integration.core.Message;
import org.springframework.util.Assert;
/**
* A simple MessageHandler implementation that passes the request Message
@@ -26,11 +28,20 @@ import org.springframework.integration.core.Message;
*
* @author Mark Fisher
*/
public class BridgeHandler extends AbstractReplyProducingMessageHandler {
public class BridgeHandler extends AbstractReplyProducingMessageHandler implements InitializingBean {
public void afterPropertiesSet() {
this.verifyOutputChannel();
}
@Override
protected void handleRequestMessage(Message<?> requestMessage, ReplyMessageHolder replyMessageHolder) {
this.verifyOutputChannel();
replyMessageHolder.set(requestMessage);
}
private void verifyOutputChannel() {
Assert.state(super.getOutputChannel() != null, "Bridge handler requires an output channel");
}
}