E
- The EventMessage
contained in this DeadLetter
.public class JdbcDeadLetter<E extends EventMessage<?>> extends Object implements DeadLetter<E>
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.Constructor and Description |
---|
JdbcDeadLetter(String identifier,
long index,
String sequenceIdentifier,
Instant enqueuedAt,
Instant lastTouched,
Cause cause,
MetaData diagnostics,
E message)
Constructs a new
JdbcDeadLetter with all possible parameters. |
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) |
String |
getIdentifier()
The identifier of this letter's database entry.
|
String |
getSequenceIdentifier()
The sequence identifier of this
DeadLetter . |
long |
getSequenceIndex()
The index of this dead letter within its sequence, identified by the
sequenceIdentifier . |
int |
hashCode() |
Instant |
lastTouched()
The moment in time when this letter was last touched.
|
DeadLetter<E> |
markTouched()
Construct a copy of this
DeadLetter , replacing the DeadLetter.lastTouched() with the current time. |
E |
message()
The
Message of type M contained in this letter. |
String |
toString() |
DeadLetter<E> |
withCause(Throwable requeueCause)
|
DeadLetter<E> |
withDiagnostics(MetaData diagnostics)
Construct a copy of this
DeadLetter , replacing the DeadLetter.diagnostics() with the given
diagnostics . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
withDiagnostics
public JdbcDeadLetter(String identifier, long index, String sequenceIdentifier, Instant enqueuedAt, Instant lastTouched, Cause cause, MetaData diagnostics, E message)
JdbcDeadLetter
with all possible 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 the sequenceIdentifier
).diagnostics
- The diagnostics provided during enqueueing.message
- The message that was enqueued.public E message()
DeadLetter
Message
of type M
contained in this letter.message
in interface DeadLetter<E extends EventMessage<?>>
Message
of type M
contained in this letter.public Optional<Cause> cause()
DeadLetter
cause
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<E extends EventMessage<?>>
cause
for the DeadLetter.message()
to be dead lettered.public Instant enqueuedAt()
DeadLetter
DeadLetter.message()
was entered in a dead letter queue.enqueuedAt
in interface DeadLetter<E extends EventMessage<?>>
DeadLetter.message()
was entered in a dead letter queue.public Instant lastTouched()
DeadLetter
DeadLetter.enqueuedAt()
value if this letter
is enqueued for the first time.lastTouched
in interface DeadLetter<E extends EventMessage<?>>
public MetaData diagnostics()
DeadLetter
MetaData
concerning this letter.diagnostics
in interface DeadLetter<E extends EventMessage<?>>
MetaData
concerning this letter.public String getIdentifier()
JdbcDeadLetter
.public long getSequenceIndex()
sequenceIdentifier
. The index
ensures the events are kept in the original order.JdbcDeadLetter
.public String getSequenceIdentifier()
DeadLetter
. If letters belong to the same sequence, they should be
handled sequentially at all times. This ordering is maintained through the getSequenceIndex()
property.DeadLetter
.public DeadLetter<E> markTouched()
DeadLetter
DeadLetter
, replacing the DeadLetter.lastTouched()
with the current time.markTouched
in interface DeadLetter<E extends EventMessage<?>>
DeadLetter
with DeadLetter.lastTouched()
set to now.public DeadLetter<E> withCause(Throwable requeueCause)
DeadLetter
withCause
in interface DeadLetter<E extends EventMessage<?>>
requeueCause
- The new cause of the DeadLetter
under construction.DeadLetter
, replacing the DeadLetter.cause()
with the given requeueCause
.public DeadLetter<E> withDiagnostics(MetaData diagnostics)
DeadLetter
DeadLetter
, replacing the DeadLetter.diagnostics()
with the given
diagnostics
.withDiagnostics
in interface DeadLetter<E extends EventMessage<?>>
diagnostics
- The diagnostic MetaData
to append to the DeadLetter
under construction.DeadLetter
, replacing the DeadLetter.diagnostics()
with the given
diagnostics
.Copyright © 2010–2024. All rights reserved.