类 ErrorMessage
- java.lang.Object
- org.springframework.messaging.support.GenericMessage<Throwable>
- org.springframework.messaging.support.ErrorMessage
- 所有已实现的接口:
Serializable
,Message<Throwable>
public class ErrorMessage extends GenericMessage<Throwable>
AGenericMessage
with aThrowable
payload.The payload is typically a
MessagingException
with the message at the point of failure in itsfailedMessage
property. An optionaloriginalMessage
may be provided, which represents the message that existed at the point in the stack where the error message is created.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.
- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher, Oleg Zhurakousky, Gary Russell
- 另请参阅:
MessageBuilder
, 序列化表格
构造器概要
构造器 构造器 说明 ErrorMessage(Throwable payload)
Create a new message with the given payload.ErrorMessage(Throwable payload, Map<String,Object> headers)
Create a new message with the given payload and headers.ErrorMessage(Throwable payload, Map<String,Object> headers, Message<?> originalMessage)
Create a new message with the given payload, headers and original message.ErrorMessage(Throwable payload, Message<?> originalMessage)
Create a new message with the given payload and original message.ErrorMessage(Throwable payload, MessageHeaders headers)
A constructor with theMessageHeaders
instance to use.ErrorMessage(Throwable payload, MessageHeaders headers, Message<?> originalMessage)
Create a new message with the payload,MessageHeaders
and original message.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Message<?>
getOriginalMessage()
Return the original message (if available) at the point in the stack where the ErrorMessage was created.String
toString()
从类继承的方法 org.springframework.messaging.support.GenericMessage
equals, getHeaders, getPayload, hashCode
构造器详细资料
ErrorMessage
public ErrorMessage(Throwable payload)
Create a new message with the given payload.- 参数:
payload
- the message payload (nevernull
)
ErrorMessage
public ErrorMessage(Throwable payload, Map<String,Object> headers)
Create a new message with the given payload and headers. The content of the given header map is copied.- 参数:
payload
- the message payload (nevernull
)headers
- message headers to use for initialization
ErrorMessage
public ErrorMessage(Throwable payload, MessageHeaders headers)
A constructor with theMessageHeaders
instance to use.Note: the given
MessageHeaders
instance is used directly in the new message, i.e. it is not copied.- 参数:
payload
- the message payload (nevernull
)headers
- message headers
ErrorMessage
public ErrorMessage(Throwable payload, Message<?> originalMessage)
Create a new message with the given payload and original message.- 参数:
payload
- the message payload (nevernull
)originalMessage
- the original message (if present) at the point in the stack where the ErrorMessage was created- 从以下版本开始:
- 5.0
ErrorMessage
public ErrorMessage(Throwable payload, Map<String,Object> headers, Message<?> originalMessage)
Create a new message with the given payload, headers and original message. The content of the given header map is copied.- 参数:
payload
- the message payload (nevernull
)headers
- message headers to use for initializationoriginalMessage
- the original message (if present) at the point in the stack where the ErrorMessage was created- 从以下版本开始:
- 5.0
ErrorMessage
public ErrorMessage(Throwable payload, MessageHeaders headers, Message<?> originalMessage)
Create a new message with the payload,MessageHeaders
and original message.Note: the given
MessageHeaders
instance is used directly in the new message, i.e. it is not copied.- 参数:
payload
- the message payload (nevernull
)headers
- message headersoriginalMessage
- the original message (if present) at the point in the stack where the ErrorMessage was created- 从以下版本开始:
- 5.0
方法详细资料
getOriginalMessage
@Nullable public Message<?> getOriginalMessage()
Return the original message (if available) at the point in the stack where the ErrorMessage was created.- 从以下版本开始:
- 5.0
toString
public String toString()
- 覆盖:
toString
在类中GenericMessage<Throwable>