AMQP: Use ErrorMessageStrategy

Fix a couple of places where `ErrorMessage` was created directly instead
of delegating to the configured `ErrorMessageStrategy`.
This commit is contained in:
Gary Russell
2017-06-02 23:47:06 -04:00
committed by Artem Bilan
parent cb444d8f5d
commit b1f74577db
2 changed files with 2 additions and 4 deletions

View File

@@ -30,7 +30,6 @@ import org.springframework.integration.amqp.support.AmqpHeaderMapper;
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
import org.springframework.integration.context.OrderlyShutdownCapable;
import org.springframework.integration.endpoint.MessageProducerSupport;
import org.springframework.messaging.support.ErrorMessage;
import org.springframework.util.Assert;
import com.rabbitmq.client.Channel;
@@ -137,7 +136,7 @@ public class AmqpInboundChannelAdapter extends MessageProducerSupport implements
}
catch (RuntimeException e) {
if (getErrorChannel() != null) {
getMessagingTemplate().send(getErrorChannel(), new ErrorMessage(
getMessagingTemplate().send(getErrorChannel(), buildErrorMessage(null,
new ListenerExecutionFailedException("Message conversion failed", e, message)));
}
else {

View File

@@ -34,7 +34,6 @@ import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
import org.springframework.integration.gateway.MessagingGatewaySupport;
import org.springframework.messaging.support.ErrorMessage;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -177,7 +176,7 @@ public class AmqpInboundGateway extends MessagingGatewaySupport {
}
catch (RuntimeException e) {
if (getErrorChannel() != null) {
AmqpInboundGateway.this.messagingTemplate.send(getErrorChannel(), new ErrorMessage(
AmqpInboundGateway.this.messagingTemplate.send(getErrorChannel(), buildErrorMessage(null,
new ListenerExecutionFailedException("Message conversion failed", e, message)));
}
else {