M
- An implementation of Message
contained in the dead letter
that's been made a
decision on.public class ShouldEnqueue<M extends Message<?>> extends Object implements EnqueueDecision<M>
EnqueueDecision
stating a dead letter
should be enqueued.Constructor and Description |
---|
ShouldEnqueue()
Constructs a default
EnqueueDecision . |
ShouldEnqueue(Throwable enqueueCause)
|
ShouldEnqueue(Throwable enqueueCause,
Function<DeadLetter<? extends M>,MetaData> diagnosticsBuilder)
|
Modifier and Type | Method and Description |
---|---|
Optional<Throwable> |
enqueueCause()
|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
shouldEnqueue()
The decision whether the
dead letter should be enqueued in a queue. |
String |
toString() |
DeadLetter<? extends M> |
withDiagnostics(DeadLetter<? extends M> letter)
|
public ShouldEnqueue()
EnqueueDecision
. This decision does not carry any enqueueCause()
or
diagnostics
.public ShouldEnqueue(Throwable enqueueCause)
enqueueCause
- The Throwable
that was used to decide to enqueue.public ShouldEnqueue(Throwable enqueueCause, Function<DeadLetter<? extends M>,MetaData> diagnosticsBuilder)
enqueueCause
- The Throwable
that was used to decide to enqueue.diagnosticsBuilder
- A function constructing diagnostics to append during
withDiagnostics(DeadLetter)
.public boolean shouldEnqueue()
EnqueueDecision
dead letter
should be enqueued in a queue. When false
the
dead letter should be evicted.shouldEnqueue
in interface EnqueueDecision<M extends Message<?>>
true
if the dead letter
should be enqueued, false
if the dead letter
should be evicted.public Optional<Throwable> enqueueCause()
EnqueueDecision
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.enqueueCause
in interface EnqueueDecision<M extends Message<?>>
dead letter
, when present.public DeadLetter<? extends M> withDiagnostics(DeadLetter<? extends M> letter)
EnqueueDecision
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.
withDiagnostics
in interface EnqueueDecision<M extends Message<?>>
letter
- The dead letter
to add diagnostic
MetaData
to.letter
when diagnostic
MetaData
was added.Copyright © 2010–2023. All rights reserved.