Class JpaSequencedDeadLetterQueue.Builder<T extends EventMessage>
- Type Parameters:
T- The type ofMessagemaintained in thisJpaSequencedDeadLetterQueue.
- Enclosing class:
JpaSequencedDeadLetterQueue<M extends EventMessage>
JpaSequencedDeadLetterQueue.
The maximum number of unique sequences defaults to 1024, the maximum amount of dead letters inside a
unique sequence to 1024, the claim duration defaults to 30 seconds, the query page size defaults
to 100, and the converter defaults to EventMessageDeadLetterJpaConverter.
The processingGroup, TransactionalExecutorProvider, eventConverter, and
genericConverter have to be configured for the JpaSequencedDeadLetterQueue to be
constructed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aJpaSequencedDeadLetterQueueas specified through this Builder.claimDuration(Duration claimDuration) Sets the claim duration, which is the time a message gets locked when processing and waiting for it to complete.converter(DeadLetterJpaConverter<EventMessage> converter) eventConverter(EventConverter eventConverter) Sets theEventConverterto convert the event payload and metadata of theDeadLetterwhen storing it to and retrieving it from the database.genericConverter(Converter genericConverter) Sets theConverterto convert the tracking token and diagnostics of theDeadLetterwhen storing it to and retrieving it from the database.maxSequences(int maxSequences) Sets the maximum number of unique sequences thisSequencedDeadLetterQueuemay contain.maxSequenceSize(int maxSequenceSize) Sets the maximum amount oflettersper unique sequences thisSequencedDeadLetterQueuecan store.processingGroup(String processingGroup) Sets the processing group, which is used for storing and querying which event processor the dead-lettered item belonged to.queryPageSize(int queryPageSize) Modifies the page size used when retrieving a sequence of dead letters.transactionalExecutorProvider(TransactionalExecutorProvider<jakarta.persistence.EntityManager> transactionalExecutorProvider) Sets theTransactionalExecutorProviderwhich provides theTransactionalExecutorused to execute operations against the underlying database for thisJpaSequencedDeadLetterQueueimplementation.protected voidvalidate()Validate whether the fields contained in this Builder are set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
processingGroup
Sets the processing group, which is used for storing and querying which event processor the dead-lettered item belonged to.- Parameters:
processingGroup- The processing group of thisSequencedDeadLetterQueue.- Returns:
- the current Builder instance, for fluent interfacing
-
maxSequences
Sets the maximum number of unique sequences thisSequencedDeadLetterQueuemay contain.The given
maxSequencesis required to be a strictly positive number (greater than 0). It defaults to1024.- Parameters:
maxSequences- The maximum amount of unique sequences for the queue under construction.- Returns:
- The current Builder, for fluent interfacing.
-
maxSequenceSize
Sets the maximum amount oflettersper unique sequences thisSequencedDeadLetterQueuecan store.The given
maxSequenceSizeis required to be a strictly positive number (greater than 0). It defaults to1024.- Parameters:
maxSequenceSize- The maximum amount oflettersper unique sequence.- Returns:
- The current Builder, for fluent interfacing.
-
transactionalExecutorProvider
public JpaSequencedDeadLetterQueue.Builder<T> transactionalExecutorProvider(TransactionalExecutorProvider<jakarta.persistence.EntityManager> transactionalExecutorProvider) Sets theTransactionalExecutorProviderwhich provides theTransactionalExecutorused to execute operations against the underlying database for thisJpaSequencedDeadLetterQueueimplementation.- Parameters:
transactionalExecutorProvider- ATransactionalExecutorProviderprovidingTransactionalExecutorsused to access the underlying database.- Returns:
- the current Builder instance, for fluent interfacing
-
eventConverter
Sets theEventConverterto convert the event payload and metadata of theDeadLetterwhen storing it to and retrieving it from the database.- Parameters:
eventConverter- The event converter to use for payload and metadata conversion.- Returns:
- the current Builder instance, for fluent interfacing
-
genericConverter
Sets theConverterto convert the tracking token and diagnostics of theDeadLetterwhen storing it to and retrieving it from the database.- Parameters:
genericConverter- The converter to use for tracking token and diagnostics conversion.- Returns:
- the current Builder instance, for fluent interfacing
-
converter
public JpaSequencedDeadLetterQueue.Builder<T> converter(DeadLetterJpaConverter<EventMessage> converter) Sets theDeadLetterJpaConverterused to convertEventMessagesto and fromDeadLetterEventEntries. Defaults toEventMessageDeadLetterJpaConverter.- Parameters:
converter- The converter to use.- Returns:
- the current Builder instance, for fluent interfacing
-
claimDuration
Sets the claim duration, which is the time a message gets locked when processing and waiting for it to complete. Other invocations of theJpaSequencedDeadLetterQueue.process(Predicate, Function, ProcessingContext)method will be unable to process a sequence while the claim is active. Its default is 30 seconds.Claims are automatically released once the item is requeued, the claim time is a backup policy in case of unforeseen trouble such as down database connections.
- Parameters:
claimDuration- The longest claim duration allowed.- Returns:
- the current Builder instance, for fluent interfacing
-
queryPageSize
Modifies the page size used when retrieving a sequence of dead letters. Defaults to100items in a page.- Parameters:
queryPageSize- The page size- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aJpaSequencedDeadLetterQueueas specified through this Builder.- Returns:
- A
JpaSequencedDeadLetterQueueas specified through this Builder.
-
validate
protected void validate()Validate whether the fields contained in this Builder are set accordingly.- Throws:
AxonConfigurationException- When one field asserts to be incorrect according to the Builder's specifications.
-