INT-1623 replaced 'exception-mapper' with 'error-channel' on 'gateway' and JMS 'inbound-gateway' elements

This commit is contained in:
Mark Fisher
2010-11-15 23:57:58 -05:00
parent 498fcd8c3c
commit c6d68c9e2a
11 changed files with 133 additions and 121 deletions

View File

@@ -70,21 +70,24 @@ public class ChannelPublishingJmsMessageListener extends MessagingGatewaySupport
private volatile DestinationResolver destinationResolver = new DynamicDestinationResolver();
private volatile JmsHeaderMapper headerMapper = new DefaultJmsHeaderMapper();
public String getComponentType(){
if (expectReply){
public String getComponentType() {
if (expectReply) {
return "jms:inbound-gateway";
} else {
}
else {
return "jms:message-driven-channel-adapter";
}
}
/**
* Specify whether a JMS reply Message is expected.
*/
public void setExpectReply(boolean expectReply) {
this.expectReply = expectReply;
}
/**
* Set the default reply destination to send reply messages to. This will
* be applied in case of a request message that does not carry a

View File

@@ -161,7 +161,7 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "extract-request-payload");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "extract-reply-payload");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "exception-mapper");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel");
int defaults = 0;
if (StringUtils.hasText(element.getAttribute(DEFAULT_REPLY_DESTINATION_ATTRIB))) {
defaults++;

View File

@@ -496,7 +496,6 @@
</xsd:attribute>
<xsd:attribute name="request-destination-name" type="xsd:string"/>
<xsd:attribute name="request-pub-sub-domain" type="xsd:string"/>
<xsd:attribute name="exception-mapper" type="xsd:string"/>
<xsd:attribute name="default-reply-destination" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
@@ -535,6 +534,15 @@
</xsd:attribute>
<xsd:attribute name="request-timeout" type="xsd:string"/>
<xsd:attribute name="reply-timeout" type="xsd:string"/>
<xsd:attribute name="error-channel" type="xsd:string">
<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:attribute name="transaction-manager" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>

View File

@@ -23,16 +23,19 @@
<int-jms:inbound-gateway request-destination="requestQueueB"
request-channel="jmsinputchannel"
exception-mapper="errorMessageMapper"/>
error-channel="errorTransformationChannel"/>
<int-jms:inbound-gateway request-destination="requestQueueA"
request-channel="jmsinputchannel"/>
<int-jms:inbound-gateway request-destination="requestQueueC"
request-channel="jmsinputchannel"
exception-mapper="errorMessageMapper"/>
error-channel="errorTransformationChannel"/>
<bean id="errorMessageMapper" class="org.springframework.integration.jms.config.ExceptionHandlingSiConsumerTests$SampleErrorMessageMapper"/>
<int:transformer input-channel="errorTransformationChannel">
<bean id="errorTransformer" class="org.springframework.integration.jms.config.ExceptionHandlingSiConsumerTests$SampleErrorTransformer"/>
</int:transformer>
<int:channel id="jmsinputchannel"/>
<int:router input-channel="jmsinputchannel" expression="payload"/>

View File

@@ -30,14 +30,12 @@ import org.junit.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.mapping.InboundMessageMapper;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
/**
* @author Oleg Zhurakousky
*
*/
public class ExceptionHandlingSiConsumerTests {
@@ -120,8 +118,8 @@ public class ExceptionHandlingSiConsumerTests {
}
public static class SampleErrorMessageMapper implements InboundMessageMapper<Throwable> {
public org.springframework.integration.Message<?> toMessage(Throwable t) throws Exception {
public static class SampleErrorTransformer {
public org.springframework.integration.Message<?> transform(Throwable t) throws Exception {
return MessageBuilder.withPayload(t.getCause().getMessage()).build();
}
}