Class ThrowableCause
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.axonframework.common.AxonException
org.axonframework.messaging.deadletter.ThrowableCause
- All Implemented Interfaces:
Serializable,Cause
- Since:
- 4.6.0
- Author:
- Steven van Beelen, Mitchel Herrijgers
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default size of1023to truncate aThrowable.getMessage()to, to fit into typical dead-letter storages. -
Constructor Summary
ConstructorsConstructorDescriptionThrowableCause(String type, String message) Constructs a cause based on the givetypeandmessage.ThrowableCause(Throwable throwable) Construct a cause based on the giventhrowable. -
Method Summary
Modifier and TypeMethodDescriptionstatic ThrowableCauseReturn the givencauseas aThrowableCause.booleaninthashCode()message()A message describing a cause for dead lettering.toString()static ThrowableCauseConstruct aThrowableCausebased on the giventhrowable, truncating the message to a maximum size ofTRUNCATED_MESSAGE_SIZE.static ThrowableCauseConstruct aThrowableCausebased on the giventhrowable, truncating the message to the givenmessageSize.type()Returns the type of dead lettering cause.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Field Details
-
TRUNCATED_MESSAGE_SIZE
public static final int TRUNCATED_MESSAGE_SIZEThe default size of1023to truncate aThrowable.getMessage()to, to fit into typical dead-letter storages.- See Also:
-
-
Constructor Details
-
ThrowableCause
Construct a cause based on the giventhrowable. Uses the fully qualified class name as thetypeand theThrowable.getMessage()as themessage.- Parameters:
throwable- The throwable to base this cause on.
-
ThrowableCause
Constructs a cause based on the givetypeandmessage.- Parameters:
type- The type of this cause.message- The message of this cause.
-
-
Method Details
-
asCause
Return the givencauseas aThrowableCause.If the given
causeis an instance ofThrowableCauseit is returned as is. Otherwise, this method constructs a new instance throughThrowableCause(Throwable).- Parameters:
cause- TheThrowableto map to aThrowableCause.- Returns:
- A
ThrowableCausebased on the givencause, or thecauseas-is if it is an instance ofThrowableCause.
-
truncated
Construct aThrowableCausebased on the giventhrowable, truncating the message to a maximum size ofTRUNCATED_MESSAGE_SIZE.Should be used to ensure the
Causefits in the desired dead-letter storage solution.- Parameters:
throwable- TheThrowableto adjust to aThrowableCause.- Returns:
- A
ThrowableCausebased on the giventhrowablefor which the message is truncated toTRUNCATED_MESSAGE_SIZE.
-
truncated
Construct aThrowableCausebased on the giventhrowable, truncating the message to the givenmessageSize.Should be used to ensure the
Causefits in the desired dead-letter storage solution.- Parameters:
throwable- TheThrowableto adjust to aThrowableCause.messageSize- The size to truncate theThrowable.getMessage()to, to be able to fit in databases.- Returns:
- A
ThrowableCausebased on the giventhrowablefor which the message is truncated to givenmessageSize.
-
type
Description copied from interface:CauseReturns the type of dead lettering cause. Thetypecan, for example, reflect the fully qualified class name of aThrowable. -
message
Description copied from interface:CauseA message describing a cause for dead lettering. Themessage()can, for example, reflect the message of aThrowable. -
equals
-
hashCode
public int hashCode() -
toString
-