Class JdbcSequencedDeadLetterQueue.Builder<E extends EventMessage>
- Type Parameters:
E- The type ofEventMessagemaintained in thedead letterof thisSequencedDeadLetterQueue.
- Enclosing class:
JdbcSequencedDeadLetterQueue<E extends EventMessage>
JdbcSequencedDeadLetterQueue.
The following defaults are set by the builder:
- The
table's schemadefaults to aDeadLetterSchema.defaultSchema(). - The
maximum amount of sequencesdefaults to1024. - The
maximum sequence sizedefaults to1024. - The
page sizedefaults to100. - The
claim durationdefaults to 30 seconds.
The processing group,
TransactionalExecutorProvider,
EventConverter, and
generic Converter are hard requirements and should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aJdbcSequencedDeadLetterQueueas specified through this Builder.claimDuration(Duration claimDuration) Sets the claim duration, which is the time a dead-letter gets locked when processing and waiting for it to complete.converter(DeadLetterJdbcConverter<E, ? extends JdbcDeadLetter<E>> 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.pageSize(int pageSize) Modifies the page size used when retrieving a sequence of dead letters.processingGroup(String processingGroup) Sets the processing group, which is used for storing and querying which processing group a dead-letteredEventMessagebelonged to.schema(DeadLetterSchema schema) Sets theDeadLetterSchemaused to constructs the table and indices required by thisSequencedDeadLetterQueue.statementFactory(DeadLetterStatementFactory<E> statementFactory) Sets theDeadLetterStatementFactoryused to construct allPreparedStatementsexecuted by thisSequencedDeadLetterQueue.transactionalExecutorProvider(TransactionalExecutorProvider<Connection> transactionalExecutorProvider) Sets theTransactionalExecutorProviderwhich provides theTransactionalExecutorused to execute operations against the underlying database for thisJdbcSequencedDeadLetterQueueimplementation.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 processing group a dead-letteredEventMessagebelonged to.- Parameters:
processingGroup- The processing group of thisSequencedDeadLetterQueue.- Returns:
- The current Builder instance, for fluent interfacing.
-
transactionalExecutorProvider
public JdbcSequencedDeadLetterQueue.Builder<E> transactionalExecutorProvider(TransactionalExecutorProvider<Connection> transactionalExecutorProvider) Sets theTransactionalExecutorProviderwhich provides theTransactionalExecutorused to execute operations against the underlying database for thisJdbcSequencedDeadLetterQueueimplementation.- Parameters:
transactionalExecutorProvider- ATransactionalExecutorProviderprovidingTransactionalExecutorsused to access the underlying database.- Returns:
- The current Builder instance, for fluent interfacing.
-
schema
Sets theDeadLetterSchemaused to constructs the table and indices required by thisSequencedDeadLetterQueue.The
schemawill be used to construct theDeadLetterStatementFactorywhen it is not explicitly configured.Defaults to the default
schemaconfiguration.- Parameters:
schema- TheDeadLetterSchemaused to constructs the table and indices required by this dead-letter queue.- Returns:
- The current Builder, for fluent interfacing.
-
statementFactory
public JdbcSequencedDeadLetterQueue.Builder<E> statementFactory(DeadLetterStatementFactory<E> statementFactory) Sets theDeadLetterStatementFactoryused to construct allPreparedStatementsexecuted by thisSequencedDeadLetterQueue.When the
statementFactoryis not explicitly configured, this builder defaults to theDefaultDeadLetterStatementFactory. To construct theDefaultDeadLetterStatementFactory, the configuredEventConverterandgeneric Converterare used.- Parameters:
statementFactory- TheDeadLetterStatementFactoryused to construct allPreparedStatementsexecuted by thisSequencedDeadLetterQueue.- Returns:
- The current Builder, for fluent interfacing.
-
converter
public JdbcSequencedDeadLetterQueue.Builder<E> converter(DeadLetterJdbcConverter<E, ? extends JdbcDeadLetter<E>> converter) Sets theDeadLetterJdbcConverterused to convert aResultSetinto aJdbcDeadLetterimplementation. Theconverteris, for example, used to service theJdbcSequencedDeadLetterQueue.deadLetters(ProcessingContext)andJdbcSequencedDeadLetterQueue.deadLetterSequence(Object, ProcessingContext)operations.When the
converteris not explicitly configured, this builder defaults to theDefaultDeadLetterJdbcConverter. To construct theDefaultDeadLetterJdbcConverter, the configuredEventConverterandgeneric Converterare used.- Parameters:
converter- TheDeadLetterJdbcConverterused to convert aResultSetinto aJdbcDeadLetterimplementation.- Returns:
- The current Builder, for fluent interfacing.
-
eventConverter
Sets theEventConverterto convert the event payload and metadata of theDeadLetterwhen storing it to and retrieving it from the database.The
eventConverterwill be used to construct theDeadLetterStatementFactoryand/orDeadLetterJdbcConverterwhen either of them are not explicitly configured.- 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.The
genericConverterwill be used to construct theDeadLetterStatementFactoryand/orDeadLetterJdbcConverterwhen either of them are not explicitly configured.- Parameters:
genericConverter- The converter to use for tracking token and diagnostics conversion.- 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 positive number. The maximum number of unique sequences 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 positive number. The maximum amount of letters per unique sequence defaults to1024.- Parameters:
maxSequenceSize- The maximum amount oflettersper unique sequence.- Returns:
- The current Builder, for fluent interfacing.
-
claimDuration
Sets the claim duration, which is the time a dead-letter gets locked when processing and waiting for it to complete. Other invocations of theJdbcSequencedDeadLetterQueue.process(Predicate, Function, ProcessingContext)method will be unable to process a sequence while the claim is active. The claim duration defaults to 30 seconds.Claims are automatically released once the item is requeued. Thus, the claim time is a backup policy in case of unforeseen trouble such as database connection issues.
- Parameters:
claimDuration- The longest claim duration allowed.- Returns:
- The current Builder instance, for fluent interfacing.
-
pageSize
Modifies the page size used when retrieving a sequence of dead letters.Used during the
JdbcSequencedDeadLetterQueue.deadLetterSequence(Object, ProcessingContext)andJdbcSequencedDeadLetterQueue.deadLetters(ProcessingContext)operations. Defaults to100.- Parameters:
pageSize- The page size used when retrieving a sequence of dead letters.- Returns:
- The current Builder instance, for fluent interfacing.
-
build
Initializes aJdbcSequencedDeadLetterQueueas specified through this Builder.- Returns:
- A
JdbcSequencedDeadLetterQueueas 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.
-