public static class DeadLetteringEventHandlerInvoker.Builder extends SimpleEventHandlerInvoker.Builder<DeadLetteringEventHandlerInvoker.Builder>
DeadLetteringEventHandlerInvoker.
The EnqueuePolicy defaults to returning Decisions.enqueue(Throwable) that truncates the
Throwable.getMessage() size to 1024 characters when invoked for any dead letter, the
ListenerInvocationErrorHandler is defaulted to a PropagatingErrorHandler, the
SequencingPolicy to a SequentialPerAggregatePolicy, allowReset defaults to false,
sequenceIdentifierCacheEnabled defaults to false and sequenceIdentifierCacheSize used
defaults to 1024. Providing at least one Event Handler, a SequencedDeadLetterQueue, and a
TransactionManager are hard requirements and as such should be provided.
eventHandlers, eventHandlers, handlerDefinition, listenerInvocationErrorHandler, parameterResolverFactory, sequencingPolicy, wrapEventMessageHandlerpublic DeadLetteringEventHandlerInvoker.Builder queue(@Nonnull SequencedDeadLetterQueue<EventMessage<?>> queue)
SequencedDeadLetterQueue this EventHandlerInvoker maintains dead letters with.queue - The SequencedDeadLetterQueue this EventHandlerInvoker maintains dead letters
with.public DeadLetteringEventHandlerInvoker.Builder enqueuePolicy(EnqueuePolicy<EventMessage<?>> enqueuePolicy)
EnqueuePolicy this EventHandlerInvoker uses to decide whether a
dead letter should be added to the SequencedDeadLetterQueue. Defaults to returning
Decisions.enqueue(Throwable) that truncates the Throwable.getMessage() size to 1024
characters when invoked for any dead letter.enqueuePolicy - The EnqueuePolicy this EventHandlerInvoker uses to decide whether a
dead letter should be added to the SequencedDeadLetterQueue.public DeadLetteringEventHandlerInvoker.Builder transactionManager(@Nonnull TransactionManager transactionManager)
TransactionManager used by this invoker for all operations involving the configured
SequencedDeadLetterQueue.transactionManager - The TransactionManager used by this invoker for all operations
involving the configured SequencedDeadLetterQueuepublic DeadLetteringEventHandlerInvoker.Builder allowReset(boolean allowReset)
DeadLetteringEventHandlerInvoker supports resets of the provided
SequencedDeadLetterQueue. If set to true, SequencedDeadLetterQueue.clear() will be
invoked upon a SimpleEventHandlerInvoker.performReset()/SimpleEventHandlerInvoker.performReset(Object) invocation. Defaults to false.allowReset - A toggle dictating whether this DeadLetteringEventHandlerInvoker supports resets of
the provided SequencedDeadLetterQueue.public DeadLetteringEventHandlerInvoker.Builder enableSequenceIdentifierCache()
DeadLetteringEventHandlerInvoker to cache sequence identifiers. If enabled, it will
create a SequenceIdentifierCache per segment. The cache prevents calling
SequencedDeadLetterQueue.enqueueIfPresent(Object, Supplier) when we can be sure the sequence
identifier is not present.
This can happen in two cases. Either we start with an empty SequencedDeadLetterQueue,
and we haven't enqueued this identifier yet. Or the queue was not empty at the start.
In this case, we can skip the identifier once we checked that we did not enqueue it before.
If the identifier might be present, we always call the
SequencedDeadLetterQueue#enqueueIfPresent(Object, Supplier)} as the sequence might have been cleaned up in
the meantime.
public DeadLetteringEventHandlerInvoker.Builder sequenceIdentifierCacheSize(int sequenceIdentifierCacheSize)
1024.
If you have a lot of long-living aggregates, it might improve performance to increase the cache size at the cost of more memory use. If you only have aggregates that are short-lived, setting it to a lower value frees up memory, while it might not affect performance.
This setting is applied per Segment.
Note that this setting will only be used in combination with enableSequenceIdentifierCache(), and
when the SequencedDeadLetterQueue is not empty when constructing the cache.
sequenceIdentifierCacheSize - The size to keep track of sequence identifiers which are not present.public DeadLetteringEventHandlerInvoker build()
DeadLetteringEventHandlerInvoker as specified through this Builder.build in class SimpleEventHandlerInvoker.Builder<DeadLetteringEventHandlerInvoker.Builder>DeadLetteringEventHandlerInvoker as specified through this Builder.protected void validate()
validate in class SimpleEventHandlerInvoker.Builder<DeadLetteringEventHandlerInvoker.Builder>AxonConfigurationException - When one field asserts to be incorrect according to the Builder's
specifications.Copyright © 2010–2025. All rights reserved.