Interface SequencedDeadLetterProcessor<M extends Message>
- Type Parameters:
M- an implementation ofMessagecontained in the processeddead letters
- All Known Implementing Classes:
DeadLetteringEventHandlingComponent
dead letters that it has enqueued.
Should use the SequencedDeadLetterQueue for processing as this ensures dead lettered Messages
are kept in sequence. Thus processed in order through this component.
All methods in this interface return CompletableFuture to support asynchronous processing.
Implementations are responsible for creating the appropriate processing context (e.g., a UnitOfWork) for each
dead letter being processed. The DeadLetter and its message will be added as resources to the processing
context via DeadLetter.RESOURCE_KEY and Message.RESOURCE_KEY respectively. The
ProcessingContext that can be passed on process(Predicate, ProcessingContext) and
processAny(ProcessingContext) allows for effective resource management to the downstream
SequencedDeadLetterQueue and actual dead-letter processing.
- Since:
- 4.6.0
- Author:
- Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionprocess(Predicate<DeadLetter<? extends M>> sequenceFilter) Process a sequence ofdead lettersmatching the givensequenceFilter.default CompletableFuture<Boolean> process(Predicate<DeadLetter<? extends M>> sequenceFilter, @Nullable ProcessingContext context) Process a sequence ofdead lettersmatching the givensequenceFilter.default CompletableFuture<Boolean> Process any sequence ofdead lettersbelonging to this component.default CompletableFuture<Boolean> processAny(@Nullable ProcessingContext context) Process any sequence ofdead lettersbelonging to this component in the givencontext.
-
Method Details
-
process
Process a sequence ofdead lettersmatching the givensequenceFilter.Note that only a single matching sequence is processed! Furthermore, the
sequenceFilteris only invoked for the first letter of a sequence, as the first entry blocks the entire sequence.Each dead letter is processed in its own processing context (typically a
UnitOfWork), which will have theDeadLetteradded as a resource (viaDeadLetter.RESOURCE_KEY). The message from the dead letter is also added to the context viaMessage.RESOURCE_KEY.- Parameters:
sequenceFilter- a filter for the firstdead letterentries of each sequence- Returns:
- a
CompletableFuturewithtrueif at least onedead letterwas processed successfully,falseotherwise
-
process
default CompletableFuture<Boolean> process(Predicate<DeadLetter<? extends M>> sequenceFilter, @Nullable ProcessingContext context) Process a sequence ofdead lettersmatching the givensequenceFilter.The
contextcan be provided optionally to support effective resource management down stream in theSequencedDeadLetterQueueand dead-letter processing task.- Parameters:
sequenceFilter- a filter for the firstdead letterentries of each sequencecontext- the processing context in which to process the dead letters, if any- Returns:
- a
CompletableFuturewithtrueif at least onedead letterwas processed successfully,falseotherwise
-
processAny
Process any sequence ofdead lettersbelonging to this component.Note that only a single matching sequence is processed!
Each dead letter is processed in its own processing context (typically a
UnitOfWork), which will have theDeadLetteradded as a resource (viaDeadLetter.RESOURCE_KEY). The message from the dead letter is also added to the context viaMessage.RESOURCE_KEY.- Returns:
- a
CompletableFuturewithtrueif at least onedead letterwas processed successfully,falseotherwise
-
processAny
Process any sequence ofdead lettersbelonging to this component in the givencontext.The
contextcan be provided optionally to support effective resource management down stream in theSequencedDeadLetterQueueand dead-letter processing task.- Parameters:
context- the processing context in which to process the dead letters, if any- Returns:
- a
CompletableFuturewithtrueif at least onedead letterwas processed successfully,falseotherwise
-