Class JpaDeadLetter<M extends EventMessage>
java.lang.Object
org.axonframework.messaging.eventhandling.deadletter.jpa.JpaDeadLetter<M>
- Type Parameters:
M- TheEventMessagetype of the contained message.
- All Implemented Interfaces:
DeadLetter<M>
A
DeadLetter that was saved to the database and reconstructed from it. This object is immutable and should
only be changed using the withCause(Throwable), withDiagnostics(Metadata) and
markTouched() functions. These reconstruct a new object with the specified new properties.- Since:
- 4.6.0
- Author:
- Mitchell Herrijgers
-
Field Summary
Fields inherited from interface org.axonframework.messaging.deadletter.DeadLetter
RESOURCE_KEY -
Constructor Summary
ConstructorsConstructorDescriptionJpaDeadLetter(DeadLetterEntry entry, Metadata diagnostics, M message, Context context) Constructs a newJpaDeadLetterfrom aDeadLetterEntry, deserialized diagnostics and a reconstructed message entry containing both the message and its associated context. -
Method Summary
Modifier and TypeMethodDescriptioncause()Thecausefor theDeadLetter.message()to be dead lettered.context()Returns the context associated with this dead letter, containing restored resources such as tracking token and domain info (aggregate identifier, type, sequence number).The diagnosticMetadataconcerning this letter.The moment in time when theDeadLetter.message()was entered in a dead letter queue.booleangetId()The ID of the entity in the database.getIndex()The index of the dead letter within its sequence identified by thesequenceIdentifier.The sequence identifier of thisDeadLetter.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
-
Constructor Details
-
JpaDeadLetter
Constructs a newJpaDeadLetterfrom aDeadLetterEntry, deserialized diagnostics and a reconstructed message entry containing both the message and its associated context.The context contains restored resources such as tracking token and domain info (aggregate identifier, type, sequence number) that were stored when the dead letter was enqueued.
- Parameters:
entry- TheDeadLetterEntryto construct this letter from.diagnostics- The deserialized diagnosticsMetadata.message- The message that was enqueued.context- The context containing restored resources such as tracking token and aggregate data.
-
-
Method Details
-
message
Description copied from interface:DeadLetterTheMessageof typeMcontained in this letter.- Specified by:
messagein interfaceDeadLetter<M extends EventMessage>- 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 EventMessage>- 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 EventMessage>- 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 EventMessage>- 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 EventMessage>- Returns:
- The diagnostic
Metadataconcerning this letter.
-
getId
The ID of the entity in the database.- Returns:
- The ID of this
JpaDeadLetter.
-
getIndex
The index of the dead letter within its sequence identified by thesequenceIdentifier. Will ensure the events are kept in the original order.- Returns:
- The index of this
JpaDeadLetter.
-
getSequenceIdentifier
The sequence identifier of thisDeadLetter. If letters belong to the same sequence, they should be handled sequentially at all times. This is ensured by thegetIndex()property.- Returns:
- The sequence identifier of this
DeadLetter.
-
context
Returns the context associated with this dead letter, containing restored resources such as tracking token and domain info (aggregate identifier, type, sequence number).- Specified by:
contextin interfaceDeadLetter<M extends EventMessage>- Returns:
- The context with restored resources, or an empty context if no resources were stored.
-
markTouched
Description copied from interface:DeadLetterConstruct a copy of thisDeadLetter, replacing theDeadLetter.lastTouched()with the current time.- Specified by:
markTouchedin interfaceDeadLetter<M extends EventMessage>- Returns:
- A copy of this
DeadLetterwithDeadLetter.lastTouched()set to now.
-
withCause
Description copied from interface:DeadLetter- Specified by:
withCausein interfaceDeadLetter<M extends EventMessage>- 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 EventMessage>- Parameters:
diagnostics- The diagnosticMetadatato append to theDeadLetterunder construction.- Returns:
- A copy of this
DeadLetter, replacing theDeadLetter.diagnostics()with the givendiagnostics.
-
toString
-
equals
-
hashCode
public int hashCode()
-