Interface EnqueueDecision<M extends Message>
- Type Parameters:
M- An implementation ofMessagecontained in thedead letterthat'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
from the dead-letter queue.invalid reference
evicted
- Since:
- 4.6.0
- Author:
- Steven van Beelen
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanThe decision whether thedead lettershould be enqueued in a queue.default DeadLetter<? extends M> withDiagnostics(DeadLetter<? extends M> letter)
-
Method Details
-
shouldEnqueue
boolean shouldEnqueue()The decision whether thedead lettershould be enqueued in a queue. Whenfalsethe dead letter should be evicted.- Returns:
trueif thedead lettershould be enqueued,falseif the dead letter should be evicted.
-
enqueueCause
AThrowableOptionalthat was part of deciding to enqueue thedead letterin a queue. Empty if thedead lettershould 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
AddsDeadLetter.diagnostics()Metadatato the givenletter. The added diagnostics may provide additional information on the decision that may be used to influence future decisions.By default, the
letteris returned as is.- Parameters:
letter- Thedead letterto adddiagnosticMetadatato.- Returns:
- A copy of the given
letterwhendiagnosticMetadatawas added.
-