M
- The EventMessage
type of the contained message.public class JpaDeadLetter<M extends EventMessage<?>> extends Object implements DeadLetter<M>
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.Constructor and Description |
---|
JpaDeadLetter(DeadLetterEntry entry,
MetaData diagnostics,
M message)
Constructs a new
JpaDeadLetter from a DeadLetterEntry , deserialized diagnostics and a
reconstructed message. |
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 |
getId()
The ID of the entity in the database.
|
Long |
getIndex()
The index of the dead letter within its sequence identified by the
sequenceIdentifier . |
String |
getSequenceIdentifier()
The sequence identifier of this
DeadLetter . |
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, wait
withDiagnostics
public JpaDeadLetter(DeadLetterEntry entry, MetaData diagnostics, M message)
JpaDeadLetter
from a DeadLetterEntry
, deserialized diagnostics and a
reconstructed message.entry
- The DeadLetterEntry
to construct this letter from.diagnostics
- The deserialized diagnostics MetaData
.message
- The reconstructed EventMessage
.public M message()
DeadLetter
Message
of type M
contained in this letter.message
in interface DeadLetter<M 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<M 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<M 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<M extends EventMessage<?>>
public MetaData diagnostics()
DeadLetter
MetaData
concerning this letter.diagnostics
in interface DeadLetter<M extends EventMessage<?>>
MetaData
concerning this letter.public String getId()
JpaDeadLetter
.public Long getIndex()
sequenceIdentifier
. Will ensure the
events are kept in the original order.JpaDeadLetter
.public String getSequenceIdentifier()
DeadLetter
. If letters belong to the same sequence, they should be
handled sequentially at all times. This is ensured by the getIndex()
property.DeadLetter
.public DeadLetter<M> markTouched()
DeadLetter
DeadLetter
, replacing the DeadLetter.lastTouched()
with the current time.markTouched
in interface DeadLetter<M extends EventMessage<?>>
DeadLetter
with DeadLetter.lastTouched()
set to now.public DeadLetter<M> withCause(Throwable requeueCause)
DeadLetter
withCause
in interface DeadLetter<M extends EventMessage<?>>
requeueCause
- The new cause of the DeadLetter
under construction.DeadLetter
, replacing the DeadLetter.cause()
with the given requeueCause
.public DeadLetter<M> withDiagnostics(MetaData diagnostics)
DeadLetter
DeadLetter
, replacing the DeadLetter.diagnostics()
with the given
diagnostics
.withDiagnostics
in interface DeadLetter<M extends EventMessage<?>>
diagnostics
- The diagnostic MetaData
to append to the DeadLetter
under construction.DeadLetter
, replacing the DeadLetter.diagnostics()
with the given
diagnostics
.Copyright © 2010–2023. All rights reserved.