Class DeadLetterEntry
java.lang.Object
org.axonframework.messaging.eventhandling.deadletter.jpa.DeadLetterEntry
Default DeadLetter JPA entity implementation of dead letters. Used by the
JpaSequencedDeadLetterQueue to
store these into the database to be retried later.
The original message is embedded as a DeadLetterEventEntry. This is mapped, upon both storage and retrieval,
by one of the configured converters.
- Since:
- 4.6.0
- Author:
- Mitchell Herrijgers
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor required by JPA.DeadLetterEntry(String processingGroup, String sequenceIdentifier, long sequenceIndex, DeadLetterEventEntry message, Instant enqueuedAt, Instant lastTouched, Cause cause, Metadata diagnostics, Converter converter) Creates a newDeadLetterEntryconsisting of the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidReleases the message for processing by another thread or process.booleanGets the message of the original exception.Gets the class of the original exception.The unique ID of this dead letter in the database.byte[]Returns the serialized diagnostics as a byte array.The time the message was enqueued.The time the messages was last touched, meaning having been queued or having been tried to process.The embeddedDeadLetterEventEntryrepresenting the original message.The processing group this dead letter belongs to.Timestamp indicating when the processing of this dead letter has started.The sequence identifier of this dead letter.longThe index of this message within thegetSequenceIdentifier(), used for keeping the messages in the same order within the same sequence.inthashCode()voidSets the cause of the error when the message was originally processed, or processed later and the cause was updated.voidsetDiagnostics(Metadata diagnostics, Converter converter) Sets the diagnostics, using the givenConverterto serialize to byte array format.voidsetLastTouched(Instant lastTouched) Sets the time the message was last touched.toString()
-
Constructor Details
-
DeadLetterEntry
protected DeadLetterEntry()Constructor required by JPA. Do not use. -
DeadLetterEntry
public DeadLetterEntry(String processingGroup, String sequenceIdentifier, long sequenceIndex, DeadLetterEventEntry message, Instant enqueuedAt, Instant lastTouched, Cause cause, Metadata diagnostics, Converter converter) Creates a newDeadLetterEntryconsisting of the given parameters.- Parameters:
processingGroup- The processing group this message belongs to.sequenceIdentifier- The sequence identifier this message belongs to.sequenceIndex- The index of this message within the sequence.message- An embeddedDeadLetterEventEntrycontaining all information about the message itself.enqueuedAt- The time the message was enqueued.lastTouched- The time the message has been last processed.cause- The reason the message was enqueued.diagnostics- The diagnostics, a map of metadata.converter- TheConverterto use for serializing thediagnostics.
-
-
Method Details
-
getDeadLetterId
The unique ID of this dead letter in the database.- Returns:
- The unique ID.
-
getProcessingGroup
The processing group this dead letter belongs to.- Returns:
- The processing group.
-
getSequenceIdentifier
The sequence identifier of this dead letter. If two have the same, they must be handled sequentially.- Returns:
- The sequence identifier.
-
getSequenceIndex
public long getSequenceIndex()The index of this message within thegetSequenceIdentifier(), used for keeping the messages in the same order within the same sequence.- Returns:
- The index.
-
getMessage
The embeddedDeadLetterEventEntryrepresenting the original message.- Returns:
- The embedded original message.
-
getEnqueuedAt
The time the message was enqueued.- Returns:
- The time the message was enqueued.
-
getLastTouched
The time the messages was last touched, meaning having been queued or having been tried to process.- Returns:
- The time the messages was last touched.
-
setLastTouched
Sets the time the message was last touched. Should be updated every time the message has been attempted to process.- Parameters:
lastTouched- The new time to set to.
-
getProcessingStarted
Timestamp indicating when the processing of this dead letter has started. Used for claiming messages and preventing multiple processes or thread from handling items concurrently within the same sequence.- Returns:
- Timestamp of start processing.
-
getCauseType
Gets the class of the original exception.- Returns:
- The type of the cause.
-
getCauseMessage
Gets the message of the original exception.- Returns:
- The message of the cause.
-
getDiagnostics
public byte[] getDiagnostics()Returns the serialized diagnostics as a byte array.- Returns:
- The serialized diagnostics bytes.
-
setCause
Sets the cause of the error when the message was originally processed, or processed later and the cause was updated.- Parameters:
cause- The new cause to set to.
-
setDiagnostics
Sets the diagnostics, using the givenConverterto serialize to byte array format.- Parameters:
diagnostics- The new diagnostics.converter- TheConverterto use for serialization.
-
clearProcessingStarted
public void clearProcessingStarted()Releases the message for processing by another thread or process.Note: This field is set executing sql directly in
JpaSequencedDeadLetterQueuewhen claiming a dead letter. -
equals
-
hashCode
public int hashCode() -
toString
-