Interface DeadLetter<M extends Message<?>>

Type Parameters:
M - The type of Message represented by this interface.
All Known Implementing Classes:
GenericDeadLetter, JdbcDeadLetter, JpaDeadLetter, JpaDeadLetter

public interface DeadLetter<M extends Message<?>>
Interface describing a dead lettered Message implementation of generic type M.

The time of storing the message() is kept through enqueuedAt(). The last time this letter was accessed on either SequencedDeadLetterQueue.requeue(DeadLetter, UnaryOperator) or processing, is kept in lastTouched(). Additional information on why the letter is enqueued can be found in the diagnostics.

Since:
4.6.0
Author:
Steven van Beelen, Allard Buijze
  • Method Details

    • message

      M message()
      The Message of type M contained in this letter.
      Returns:
      The Message of type M contained in this letter.
    • cause

      Optional<Cause> cause()
      The cause for the 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.
      Returns:
      The cause for the message() to be dead lettered.
    • enqueuedAt

      Instant enqueuedAt()
      The moment in time when the message() was entered in a dead letter queue.
      Returns:
      The moment in time when the message() was entered in a dead letter queue.
    • lastTouched

      Instant lastTouched()
      The moment in time when this letter was last touched. Will equal the enqueuedAt() value if this letter is enqueued for the first time.
      Returns:
      The moment in time when this letter was last touched.
    • diagnostics

      MetaData diagnostics()
      The diagnostic MetaData concerning this letter.
      Returns:
      The diagnostic MetaData concerning this letter.
    • markTouched

      DeadLetter<M> markTouched()
      Construct a copy of this DeadLetter, replacing the lastTouched() with the current time.
      Returns:
      A copy of this DeadLetter with lastTouched() set to now.
    • withCause

      DeadLetter<M> withCause(Throwable requeueCause)
      Construct a copy of this DeadLetter, replacing the cause() with the given requeueCause.
      Parameters:
      requeueCause - The new cause of the DeadLetter under construction.
      Returns:
      A copy of this DeadLetter, replacing the cause() with the given requeueCause.
    • withDiagnostics

      DeadLetter<M> withDiagnostics(MetaData diagnostics)
      Construct a copy of this DeadLetter, replacing the diagnostics() with the given diagnostics.
      Parameters:
      diagnostics - The diagnostic MetaData to append to the DeadLetter under construction.
      Returns:
      A copy of this DeadLetter, replacing the diagnostics() with the given diagnostics.
    • withDiagnostics

      default DeadLetter<M> withDiagnostics(UnaryOperator<MetaData> diagnosticsBuilder)
      Construct a copy of this DeadLetter, replacing the diagnostics() with the result of the given diagnosticsBuilder. The diagnosticsBuilder will be invoked with the diagnostics of this instance.
      Parameters:
      diagnosticsBuilder - The lambda constructing diagnostic MetaData to replace the MetaData of the DeadLetter under construction.
      Returns:
      A copy of this DeadLetter, replacing the diagnostics() with the result of the given diagnosticsBuilder.