Rename AMQP_MESSAGE to AMQP_RAW_MESSAGE

See: spring-cloud/spring-cloud-stream#913

To make compatibility with Spring AMQP 2.0 `AmqpHeaders.RAW_MESSAGE`
rename `AmqpMessageHeaderErrorMessageStrategy.AMQP_MESSAGE` constant
to the `AMQP_RAW_MESSAGE` and therefore its value to the
`AmqpHeaders.PREFIX + "raw_message"`

See c10092d0c5
This commit is contained in:
Artem Bilan
2017-06-05 18:28:44 -04:00
parent 738d0b0757
commit 5c3a690cb4

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.amqp.support;
import java.util.Collections;
import java.util.Map;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.core.AttributeAccessor;
import org.springframework.integration.support.ErrorMessageStrategy;
import org.springframework.integration.support.ErrorMessageUtils;
@@ -38,15 +39,15 @@ public class AmqpMessageHeaderErrorMessageStrategy implements ErrorMessageStrate
/**
* Header name/retry context variable for the raw received message.
*/
public static final String AMQP_MESSAGE = "amqp_message"; // move to AmqpHeaders.MESSAGE in 2.0
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(
AmqpMessageHeaderErrorMessageStrategy.AMQP_MESSAGE,
context.getAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_MESSAGE));
AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE,
context.getAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE));
return inputMessage instanceof Message
? new org.springframework.integration.message.EnhancedErrorMessage(throwable, headers,
(Message<?>) inputMessage)