INT-4328: AMQP: Returns/Nacks: Create ErrorMessage

JIRA: https://jira.spring.io/browse/INT-4328

Add support for sending `ErrorMessage`s to the return and nack channels.

**cherry-pick to 4.3.x, but change default EMS to null (will require minor adjustment to test - set the EMS in `adapterWithReturnsAndErrorMessageStrategy`)**
This commit is contained in:
Gary Russell
2017-08-15 12:31:52 -04:00
committed by Artem Bilan
parent d41d707357
commit 0a1306cd1b
15 changed files with 339 additions and 82 deletions

View File

@@ -37,7 +37,8 @@ public class DefaultErrorMessageStrategy implements ErrorMessageStrategy {
@Override
public ErrorMessage buildErrorMessage(Throwable throwable, AttributeAccessor attributes) {
Object inputMessage = attributes.getAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY);
Object inputMessage = attributes == null ? null
: attributes.getAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY);
return new ErrorMessage(throwable, inputMessage instanceof Message ? (Message<?>) inputMessage : null);
}