Class JdbcDeadLetter<E extends EventMessage>
java.lang.Object
org.axonframework.messaging.eventhandling.deadletter.jdbc.JdbcDeadLetter<E>
- Type Parameters:
E- TheEventMessagecontained in thisDeadLetter.
- All Implemented Interfaces:
DeadLetter<E>
A
DeadLetter that was saved to a JDBC-backed 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.8.0
- Author:
- Mitchell Herrijgers, Steven van Beelen
-
Field Summary
Fields inherited from interface org.axonframework.messaging.deadletter.DeadLetter
RESOURCE_KEY -
Constructor Summary
ConstructorsConstructorDescriptionJdbcDeadLetter(String identifier, long index, String sequenceIdentifier, Instant enqueuedAt, Instant lastTouched, Cause cause, Metadata diagnostics, E message, Context context) Constructs a newJdbcDeadLetterwith all possible parameters. -
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.booleanThe identifier of this letter's database entry.The sequence identifier of thisDeadLetter.longThe index of this dead letter within its sequence, identified by thesequenceIdentifier.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
-
JdbcDeadLetter
public JdbcDeadLetter(String identifier, long index, String sequenceIdentifier, Instant enqueuedAt, Instant lastTouched, Cause cause, Metadata diagnostics, E message, Context context) Constructs a newJdbcDeadLetterwith all possible parameters.- Parameters:
identifier- The identifier of the dead letter.index- The index of the dead letter.sequenceIdentifier- The sequence identifier of the dead letter.enqueuedAt- The time the letter was enqueued.lastTouched- The time the letter was last touched.cause- The cause of enqueueing, can be null if it was queued because there was another letter in the same sequence (based on thesequenceIdentifier).diagnostics- The diagnostics provided during enqueueing.message- The message that was enqueued.context- The context containing restored resources such as tracking token and domain info.
-
-
Method Details
-
message
Description copied from interface:DeadLetterTheMessageof typeMcontained in this letter.- Specified by:
messagein interfaceDeadLetter<E 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<E 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<E 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<E 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<E extends EventMessage>- Returns:
- The diagnostic
Metadataconcerning this letter.
-
getIdentifier
The identifier of this letter's database entry.- Returns:
- The identifier of this
JdbcDeadLetter.
-
getSequenceIndex
public long getSequenceIndex()The index of this dead letter within its sequence, identified by thesequenceIdentifier. The index ensures the events are kept in the original order.- Returns:
- The index of this
JdbcDeadLetter.
-
getSequenceIdentifier
The sequence identifier of thisDeadLetter. If letters belong to the same sequence, they should be handled sequentially at all times. This ordering is maintained through thegetSequenceIndex()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<E 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<E extends EventMessage>- Returns:
- A copy of this
DeadLetterwithDeadLetter.lastTouched()set to now.
-
withCause
Description copied from interface:DeadLetter- Specified by:
withCausein interfaceDeadLetter<E 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<E extends EventMessage>- Parameters:
diagnostics- The diagnosticMetadatato append to theDeadLetterunder construction.- Returns:
- A copy of this
DeadLetter, replacing theDeadLetter.diagnostics()with the givendiagnostics.
-
equals
-
hashCode
public int hashCode() -
toString
-