Class DeadLetteringEventHandlingComponent

java.lang.Object
org.axonframework.messaging.eventhandling.DelegatingEventHandlingComponent
io.axoniq.framework.messaging.eventhandling.deadletter.DeadLetteringEventHandlingComponent
All Implemented Interfaces:
SequencedDeadLetterProcessor<EventMessage>, DescribableComponent, MessageHandler, EventHandler, EventHandlingComponent, ReplayStatusChangedHandler, ResetHandler

public class DeadLetteringEventHandlingComponent extends DelegatingEventHandlingComponent implements SequencedDeadLetterProcessor<EventMessage>
An EventHandlingComponent decorator that uses a SequencedDeadLetterQueue to enqueue events for which handling failed.

Uses an EnqueuePolicy to decide whether a failed event should be enqueued. Subsequent events belonging to an already enqueued "sequence identifier" are also enqueued to maintain event ordering in the face of failures.

Replayed events are treated differently when their sequence already holds dead letters. Replayed events positioned before the head of the sequence are handled by the delegate, since they may rebuild state the head letter depends on. Replayed events already present in the sequence are skipped, and a replayed event that fails is enqueued in position order instead of at the tail. Placing letters in position order touches every later letter of the sequence, so it is strongly recommended to resolve enqueued dead letters, by processing or evicting them, before replaying.

This component provides operations to processAny() dead letters it has enqueued through the SequencedDeadLetterProcessor contract. It ensures the same delegate EventHandlingComponent is used when processing dead letters as with regular event handling. Each dead letter is processed in its own UnitOfWork, providing proper transaction boundaries.

Since:
4.6.0
Author:
Steven van Beelen, Mitchell Herrijgers, Mateusz Nowak
See Also: