INT-1623 replaced 'exception-mapper' with 'error-channel' on 'gateway' and JMS 'inbound-gateway' elements
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user