Class GenericDeadLetter<M extends Message<?>>
java.lang.Object
org.axonframework.messaging.deadletter.GenericDeadLetter<M>
- All Implemented Interfaces:
DeadLetter<M>
Generic implementation of the
dead letter allowing any type of Message to be dead
lettered.- Since:
- 4.6.0
- Author:
- Steven van Beelen, Mitchell Herrijgers
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ClockClockinstance used to set theDeadLetter.enqueuedAt()andDeadLetter.lastTouched()times ondead letters. -
Constructor Summary
ConstructorsConstructorDescriptionGenericDeadLetter(Object sequenceIdentifier, M message) GenericDeadLetter(Object sequenceIdentifier, M message, Throwable cause) GenericDeadLetter(Object sequenceIdentifier, M message, Cause cause, Instant enqueuedAt, Instant lastTouched, MetaData diagnostics) Construct aGenericDeadLetterdefining all the fields. -
Method Summary
Modifier and TypeMethodDescriptioncause()Thecausefor theDeadLetter.message()to be dead lettered.The diagnosticMetaDataconcerning this letter.The moment in time when theDeadLetter.message()was entered in a dead letter queue.booleanReturns the sequence identifier of the sequence thismessage()belongs to.inthashCode()The moment in time when this letter was last touched.Construct a copy of thisDeadLetter, replacing theDeadLetter.lastTouched()with the current time.message()TheMessageof typeMcontained in this letter.toString()withDiagnostics(MetaData diagnostics) Construct a copy of thisDeadLetter, replacing theDeadLetter.diagnostics()with the givendiagnostics.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.axonframework.messaging.deadletter.DeadLetter
withDiagnostics
-
Field Details
-
clock
Clockinstance used to set theDeadLetter.enqueuedAt()andDeadLetter.lastTouched()times ondead letters. Can be adjusted to alter the desired time(zone) of those fields.
-
-
Constructor Details
-
GenericDeadLetter
Construct aGenericDeadLetterwith the givensequenceIdentifierandmessage. Thecause()is left empty in this case. This method is typically used to construct a dead letter that's part of a sequence.- Parameters:
sequenceIdentifier- The sequence identifier of theGenericDeadLetterto build.message- TheMessageof typeMof theGenericDeadLetterto build.
-
GenericDeadLetter
Construct aGenericDeadLetterwith the givensequenceIdentifier,message, andcause. This method is typically used to construct the first dead letter entry for the givenqueueIdentifier.- Parameters:
sequenceIdentifier- The sequence identifier of theGenericDeadLetterto build.message- TheMessageof typeMof theGenericDeadLetterto build.cause- The cause for themessageto be dead lettered.
-
GenericDeadLetter
public GenericDeadLetter(Object sequenceIdentifier, M message, Cause cause, Instant enqueuedAt, Instant lastTouched, MetaData diagnostics) Construct aGenericDeadLetterdefining all the fields.- Parameters:
sequenceIdentifier- The sequence identifier of theGenericDeadLetterto build.message- TheMessageof typeMof theGenericDeadLetterto build.cause- The cause for themessageto be dead lettered.enqueuedAt- The moment this dead letter is enqueued.lastTouched- The last time this dead letter was touched.diagnostics- The diagnosticMetaDataof this dead letter.
-
-
Method Details
-
message
Description copied from interface:DeadLetterTheMessageof typeMcontained in this letter.- Specified by:
messagein interfaceDeadLetter<M extends Message<?>>- Returns:
- The
Messageof typeMcontained in this letter.
-
cause
Description copied from interface:DeadLetterThecausefor theDeadLetter.message()to be dead lettered. Can be anOptional.empty()in case this letter is enqueued without a causal error. For instance, when another letter already present in the queue was blocking it being handled.- Specified by:
causein interfaceDeadLetter<M extends Message<?>>- Returns:
- The
causefor theDeadLetter.message()to be dead lettered.
-
enqueuedAt
Description copied from interface:DeadLetterThe moment in time when theDeadLetter.message()was entered in a dead letter queue.- Specified by:
enqueuedAtin interfaceDeadLetter<M extends Message<?>>- Returns:
- The moment in time when the
DeadLetter.message()was entered in a dead letter queue.
-
lastTouched
Description copied from interface:DeadLetterThe moment in time when this letter was last touched. Will equal theDeadLetter.enqueuedAt()value if this letter is enqueued for the first time.- Specified by:
lastTouchedin interfaceDeadLetter<M extends Message<?>>- Returns:
- The moment in time when this letter was last touched.
-
diagnostics
Description copied from interface:DeadLetterThe diagnosticMetaDataconcerning this letter.- Specified by:
diagnosticsin interfaceDeadLetter<M extends Message<?>>- Returns:
- The diagnostic
MetaDataconcerning this letter.
-
markTouched
Description copied from interface:DeadLetterConstruct a copy of thisDeadLetter, replacing theDeadLetter.lastTouched()with the current time.- Specified by:
markTouchedin interfaceDeadLetter<M extends Message<?>>- Returns:
- A copy of this
DeadLetterwithDeadLetter.lastTouched()set to now.
-
withCause
Description copied from interface:DeadLetter- Specified by:
withCausein interfaceDeadLetter<M extends Message<?>>- Parameters:
requeueCause- The new cause of theDeadLetterunder construction.- Returns:
- A copy of this
DeadLetter, replacing theDeadLetter.cause()with the givenrequeueCause.
-
withDiagnostics
Description copied from interface:DeadLetterConstruct a copy of thisDeadLetter, replacing theDeadLetter.diagnostics()with the givendiagnostics.- Specified by:
withDiagnosticsin interfaceDeadLetter<M extends Message<?>>- Parameters:
diagnostics- The diagnosticMetaDatato append to theDeadLetterunder construction.- Returns:
- A copy of this
DeadLetter, replacing theDeadLetter.diagnostics()with the givendiagnostics.
-
getSequenceIdentifier
Returns the sequence identifier of the sequence thismessage()belongs to.- Returns:
- The sequence identifier of the sequence this
message()belongs to.
-
equals
-
hashCode
public int hashCode() -
toString
-