Interface EnqueueDecision<M extends Message>

Type Parameters:
M - An implementation of Message contained in the dead letter that's been made a decision on.
All Known Implementing Classes:
DoNotEnqueue, Ignore, ShouldEnqueue

public interface EnqueueDecision<M extends Message>
A contract towards describing a decision among a dead letter containing a message of type M concerning whether to add it to a SequencedDeadLetterQueue.

Describes that the letter should be enqueued or not. If the letter should be enqueued the enqueueCause() may contain a Throwable. Furthermore, withDiagnostics(DeadLetter) may add diagnostic information to the dead letter that should be taken into account when enqueueing the letter.

If shouldEnqueue() returns false, that means the dead letter will not be inserted in the queue to begin with, or it will be

invalid reference
evicted
from the dead-letter queue.
Since:
4.6.0
Author:
Steven van Beelen
See Also:
  • Method Details

    • shouldEnqueue

      boolean shouldEnqueue()
      The decision whether the dead letter should be enqueued in a queue. When false the dead letter should be evicted.
      Returns:
      true if the dead letter should be enqueued, false if the dead letter should be evicted.
    • enqueueCause

      Optional<Throwable> enqueueCause()
      A Throwable Optional that was part of deciding to enqueue the dead letter in a queue. Empty if the dead letter should be evicted or when there is no failure cause used for deciding to enqueue.
      Returns:
      The deciding failure for enqueueing a dead letter, when present.
    • withDiagnostics

      default DeadLetter<? extends M> withDiagnostics(DeadLetter<? extends M> letter)
      Adds DeadLetter.diagnostics() Metadata to the given letter. The added diagnostics may provide additional information on the decision that may be used to influence future decisions.

      By default, the letter is returned as is.

      Parameters:
      letter - The dead letter to add diagnostic Metadata to.
      Returns:
      A copy of the given letter when diagnostic Metadata was added.