Create a new message with the given payload. @param payload the message payload (never {@code null})
Create a new message with the given payload and headers. The content of the given header map is copied. @param payload the message payload (never {@code null}) @param headers message headers to use for initialization
A constructor with the {@link MessageHeaders} instance to use. <p><strong>Note:</strong> the given {@code MessageHeaders} instance is used directly in the new message, i.e. it is not copied. @param payload the message payload (never {@code null}) @param headers message headers
Create a new message with the given payload and original message. @param payload the message payload (never {@code null}) @param originalMessage the original message (if present) at the point in the stack where the ErrorMessage was created @since 5.0
Create a new message with the given payload, headers and original message. The content of the given header map is copied. @param payload the message payload (never {@code null}) @param headers message headers to use for initialization @param originalMessage the original message (if present) at the point in the stack where the ErrorMessage was created @since 5.0
Create a new message with the payload, {@link MessageHeaders} and original message. <p><strong>Note:</strong> the given {@code MessageHeaders} instance is used directly in the new message, i.e. it is not copied. @param payload the message payload (never {@code null}) @param headers message headers @param originalMessage the original message (if present) at the point in the stack where the ErrorMessage was created @since 5.0
Return the original message (if available) at the point in the stack where the ErrorMessage was created. @since 5.0
A {@link GenericMessage} with a {@link Throwable} payload.
<p>The payload is typically a {@link hunt.stomp.MessagingException} with the message at the point of failure in its {@code failedMessage} property. An optional {@code originalMessage} may be provided, which represents the message that existed at the point in the stack where the error message is created.
<p>Consider some code that starts with a message, invokes some process that performs transformation on that message and then fails for some reason, throwing the exception. The exception is caught and an error message produced that contains both the original message, and the transformed message that failed.
@author Mark Fisher @author Oleg Zhurakousky @author Gary Russell @since 4.0 @see MessageBuilder