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.Fields inherited from interface org.axonframework.messaging.deadletter.DeadLetter
RESOURCE_KEY -
Constructor Summary
ConstructorsConstructorDescriptionGenericDeadLetter(Object sequenceIdentifier, M message) GenericDeadLetter(Object sequenceIdentifier, M message, Throwable cause) GenericDeadLetter(Object sequenceIdentifier, M message, Throwable cause, Context context) Construct aGenericDeadLetterwith the givensequenceIdentifier,message,cause, and associatedContext.GenericDeadLetter(Object sequenceIdentifier, M message, Cause cause, Instant enqueuedAt, Instant lastTouched, Metadata diagnostics) Construct aGenericDeadLetterdefining all the fields.GenericDeadLetter(Object sequenceIdentifier, M message, Cause cause, Instant enqueuedAt, Instant lastTouched, Metadata diagnostics, Context context) Construct aGenericDeadLetterdefining all the fields including the associatedContext. -
Method Summary
Modifier and TypeMethodDescriptioncause()Thecausefor theDeadLetter.message()to be dead lettered.context()Returns theContextassociated with this dead letter, carrying resources that were present in theProcessingContextwhen the letter was enqueued.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
Construct aGenericDeadLetterwith the givensequenceIdentifier,message,cause, and associatedContext.- Parameters:
sequenceIdentifier- The sequence identifier of theGenericDeadLetterto build.message- TheMessageof typeMof theGenericDeadLetterto build.cause- The cause for themessageto be dead lettered.context- TheContextassociated with this dead letter.
-
GenericDeadLetter
public GenericDeadLetter(Object sequenceIdentifier, M message, Cause cause, Instant enqueuedAt, Instant lastTouched, Metadata diagnostics) - 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.
-
GenericDeadLetter
public GenericDeadLetter(Object sequenceIdentifier, M message, Cause cause, Instant enqueuedAt, Instant lastTouched, Metadata diagnostics, Context context) Construct aGenericDeadLetterdefining all the fields including the associatedContext.- 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.context- TheContextassociated with 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.
-
context
Description copied from interface:DeadLetterReturns theContextassociated with this dead letter, carrying resources that were present in theProcessingContextwhen the letter was enqueued. Defaults toContext.empty()if not overridden.The following resources are stored and restored through this context:
TrackingToken.RESOURCE_KEY— always present when the letter was enqueued by a streaming event processor.LegacyResources.AGGREGATE_TYPE_KEY,LegacyResources.AGGREGATE_IDENTIFIER_KEY, andLegacyResources.AGGREGATE_SEQUENCE_NUMBER_KEY— present only when the event was stored by an aggregate-based event storage engine.
- Specified by:
contextin interfaceDeadLetter<M extends Message>- Returns:
- The
Contextassociated with this dead 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
-