Revert to Spring AMQP 2.0.0.M4
Since we don't have one more Spring AMQP 2.0 Milestone for upcoming Spring Boot Milestone Spring Integration Milestone must be compatible with current IO state. * Replace `AmqpHeaders.RAW_MESSAGE` to the `AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE` constant
This commit is contained in:
@@ -130,7 +130,7 @@ subprojects { subproject ->
|
||||
servletApiVersion = '3.1.0'
|
||||
slf4jVersion = "1.7.25"
|
||||
smackVersion = '4.1.9'
|
||||
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.0.0.BUILD-SNAPSHOT'
|
||||
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.0.0.M4'
|
||||
springDataJpaVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springDataMongoVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springDataRedisVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
|
||||
@@ -176,7 +176,7 @@ public class AmqpInboundChannelAdapter extends MessageProducerSupport implements
|
||||
AttributeAccessor attributes = attributesHolder.get();
|
||||
if (attributes != null) {
|
||||
attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message);
|
||||
attributes.setAttribute(AmqpHeaders.RAW_MESSAGE, amqpMessage);
|
||||
attributes.setAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, amqpMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ public class AmqpInboundGateway extends MessagingGatewaySupport {
|
||||
AttributeAccessor attributes = attributesHolder.get();
|
||||
if (attributes != null) {
|
||||
attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message);
|
||||
attributes.setAttribute(AmqpHeaders.RAW_MESSAGE, amqpMessage);
|
||||
attributes.setAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, amqpMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,11 +38,17 @@ import org.springframework.messaging.support.ErrorMessage;
|
||||
*/
|
||||
public class AmqpMessageHeaderErrorMessageStrategy implements ErrorMessageStrategy {
|
||||
|
||||
/**
|
||||
* Header name/retry context variable for the raw received message.
|
||||
*/
|
||||
public static final String AMQP_RAW_MESSAGE = AmqpHeaders.PREFIX + "raw_message";
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ErrorMessage buildErrorMessage(Throwable throwable, AttributeAccessor context) {
|
||||
Object inputMessage = context.getAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY);
|
||||
Map<String, Object> headers =
|
||||
Collections.singletonMap(AmqpHeaders.RAW_MESSAGE, context.getAttribute(AmqpHeaders.RAW_MESSAGE));
|
||||
Collections.singletonMap(AMQP_RAW_MESSAGE, context.getAttribute(AMQP_RAW_MESSAGE));
|
||||
return new ErrorMessage(throwable, headers, inputMessage instanceof Message ? (Message<?>) inputMessage : null);
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ public class InboundEndpointTests {
|
||||
assertThat(errorMessage.getPayload(), instanceOf(MessagingException.class));
|
||||
assertThat(((MessagingException) errorMessage.getPayload()).getMessage(), containsString("Dispatcher has no"));
|
||||
org.springframework.amqp.core.Message amqpMessage = errorMessage.getHeaders()
|
||||
.get(AmqpHeaders.RAW_MESSAGE, org.springframework.amqp.core.Message.class);
|
||||
.get(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, org.springframework.amqp.core.Message.class);
|
||||
assertThat(amqpMessage, notNullValue());
|
||||
assertNull(errors.receive(0));
|
||||
}
|
||||
@@ -334,7 +334,7 @@ public class InboundEndpointTests {
|
||||
assertThat(errorMessage.getPayload(), instanceOf(MessagingException.class));
|
||||
assertThat(((MessagingException) errorMessage.getPayload()).getMessage(), containsString("Dispatcher has no"));
|
||||
org.springframework.amqp.core.Message amqpMessage = errorMessage.getHeaders()
|
||||
.get(AmqpHeaders.RAW_MESSAGE, org.springframework.amqp.core.Message.class);
|
||||
.get(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, org.springframework.amqp.core.Message.class);
|
||||
assertThat(amqpMessage, notNullValue());
|
||||
assertNull(errors.receive(0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user