public class GenericDeadLetter<M extends Message<?>> extends Object implements DeadLetter<M>
dead letter allowing any type of Message to be dead
lettered.| Modifier and Type | Field and Description |
|---|---|
static Clock |
clock
Clock instance used to set the DeadLetter.enqueuedAt() and DeadLetter.lastTouched() times
on dead letters. |
| Constructor and Description |
|---|
GenericDeadLetter(Object sequenceIdentifier,
M message)
|
GenericDeadLetter(Object sequenceIdentifier,
M message,
Cause cause,
Instant enqueuedAt,
Instant lastTouched,
MetaData diagnostics)
Construct a
GenericDeadLetter defining all the fields. |
GenericDeadLetter(Object sequenceIdentifier,
M message,
Throwable cause)
|
| Modifier and Type | Method and Description |
|---|---|
Optional<Cause> |
cause()
The
cause for the DeadLetter.message() to be dead lettered. |
MetaData |
diagnostics()
The diagnostic
MetaData concerning this letter. |
Instant |
enqueuedAt()
The moment in time when the
DeadLetter.message() was entered in a dead letter queue. |
boolean |
equals(Object o) |
Object |
getSequenceIdentifier()
Returns the sequence identifier of the sequence this
message() belongs to. |
int |
hashCode() |
Instant |
lastTouched()
The moment in time when this letter was last touched.
|
DeadLetter<M> |
markTouched()
Construct a copy of this
DeadLetter, replacing the DeadLetter.lastTouched() with the current time. |
M |
message()
The
Message of type M contained in this letter. |
String |
toString() |
DeadLetter<M> |
withCause(Throwable requeueCause)
|
DeadLetter<M> |
withDiagnostics(MetaData diagnostics)
Construct a copy of this
DeadLetter, replacing the DeadLetter.diagnostics() with the given
diagnostics. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitwithDiagnosticspublic static Clock clock
Clock instance used to set the DeadLetter.enqueuedAt() and DeadLetter.lastTouched() times
on dead letters. Can be adjusted to alter the desired time(zone) of those fields.public GenericDeadLetter(Object sequenceIdentifier, M message)
GenericDeadLetter with the given sequenceIdentifier and message. The
cause() is left empty in this case. This method is typically used to construct a dead letter that's part
of a sequence.sequenceIdentifier - The sequence identifier of the GenericDeadLetter to build.message - The Message of type M of the GenericDeadLetter to build.public GenericDeadLetter(Object sequenceIdentifier, M message, Throwable cause)
GenericDeadLetter with the given sequenceIdentifier, message, and
cause. This method is typically used to construct the first dead letter entry for the given
queueIdentifier.sequenceIdentifier - The sequence identifier of the GenericDeadLetter to build.message - The Message of type M of the GenericDeadLetter to build.cause - The cause for the message to be dead lettered.public GenericDeadLetter(Object sequenceIdentifier, M message, Cause cause, Instant enqueuedAt, Instant lastTouched, MetaData diagnostics)
GenericDeadLetter defining all the fields.sequenceIdentifier - The sequence identifier of the GenericDeadLetter to build.message - The Message of type M of the GenericDeadLetter to build.cause - The cause for the message to be dead lettered.enqueuedAt - The moment this dead letter is enqueued.lastTouched - The last time this dead letter was touched.diagnostics - The diagnostic MetaData of this dead letter.public M message()
DeadLetterMessage of type M contained in this letter.message in interface DeadLetter<M extends Message<?>>Message of type M contained in this letter.public Optional<Cause> cause()
DeadLettercause for the DeadLetter.message() to be dead lettered. Can be an Optional.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.cause in interface DeadLetter<M extends Message<?>>cause for the DeadLetter.message() to be dead lettered.public Instant enqueuedAt()
DeadLetterDeadLetter.message() was entered in a dead letter queue.enqueuedAt in interface DeadLetter<M extends Message<?>>DeadLetter.message() was entered in a dead letter queue.public Instant lastTouched()
DeadLetterDeadLetter.enqueuedAt() value if this letter
is enqueued for the first time.lastTouched in interface DeadLetter<M extends Message<?>>public MetaData diagnostics()
DeadLetterMetaData concerning this letter.diagnostics in interface DeadLetter<M extends Message<?>>MetaData concerning this letter.public DeadLetter<M> markTouched()
DeadLetterDeadLetter, replacing the DeadLetter.lastTouched() with the current time.markTouched in interface DeadLetter<M extends Message<?>>DeadLetter with DeadLetter.lastTouched() set to now.public DeadLetter<M> withCause(@Nonnull Throwable requeueCause)
DeadLetterwithCause in interface DeadLetter<M extends Message<?>>requeueCause - The new cause of the DeadLetter under construction.DeadLetter, replacing the DeadLetter.cause() with the given requeueCause.public DeadLetter<M> withDiagnostics(MetaData diagnostics)
DeadLetterDeadLetter, replacing the DeadLetter.diagnostics() with the given
diagnostics.withDiagnostics in interface DeadLetter<M extends Message<?>>diagnostics - The diagnostic MetaData to append to the DeadLetter under construction.DeadLetter, replacing the DeadLetter.diagnostics() with the given
diagnostics.public Object getSequenceIdentifier()
message() belongs to.message() belongs to.Copyright © 2010–2023. All rights reserved.