T
- The type of Message
maintained in this JpaSequencedDeadLetterQueue
.public static class JpaSequencedDeadLetterQueue.Builder<T extends EventMessage<?>> extends Object
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 converters default to containing a single EventMessageDeadLetterJpaConverter
.
If you have custom EventMessage
to use with this queue, replace the current (or add a second) converter.
The processingGroup
, EntityManagerProvider
, TransactionManager
and Serializer
have to be configured for the JpaSequencedDeadLetterQueue
to be constructed.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
JpaSequencedDeadLetterQueue.Builder<T> |
addConverter(DeadLetterJpaConverter<EventMessage<?>> converter)
Adds a
DeadLetterJpaConverter to the configuration, which is used to deserialize dead-letter entries
from the database. |
JpaSequencedDeadLetterQueue<T> |
build()
Initializes a
JpaSequencedDeadLetterQueue as specified through this Builder. |
JpaSequencedDeadLetterQueue.Builder<T> |
claimDuration(Duration claimDuration)
Sets the claim duration, which is the time a message gets locked when processing and waiting for it to
complete.
|
JpaSequencedDeadLetterQueue.Builder<T> |
clearConverters()
Removes all current converters currently configured, including the default
EventMessageDeadLetterJpaConverter . |
JpaSequencedDeadLetterQueue.Builder<T> |
entityManagerProvider(EntityManagerProvider entityManagerProvider)
Sets the
EntityManagerProvider which provides the EntityManager used to access the underlying
database for this JpaSequencedDeadLetterQueue implementation. |
JpaSequencedDeadLetterQueue.Builder<T> |
eventSerializer(Serializer serializer)
Sets the
Serializer to (de)serialize the event payload, event metadata, and diagnostics of the
DeadLetter when storing it to the database. |
JpaSequencedDeadLetterQueue.Builder<T> |
genericSerializer(Serializer serializer)
Sets the
Serializer to (de)serialize the tracking token of the event in the DeadLetter when
storing it to the database. |
JpaSequencedDeadLetterQueue.Builder<T> |
maxSequences(int maxSequences)
Sets the maximum number of unique sequences this
SequencedDeadLetterQueue may contain. |
JpaSequencedDeadLetterQueue.Builder<T> |
maxSequenceSize(int maxSequenceSize)
Sets the maximum amount of
letters per unique sequences this
SequencedDeadLetterQueue can store. |
JpaSequencedDeadLetterQueue.Builder<T> |
processingGroup(String processingGroup)
Sets the processing group, which is used for storing and querying which event processor the deadlettered item
belonged to.
|
JpaSequencedDeadLetterQueue.Builder<T> |
queryPageSize(int queryPageSize)
Modifies the page size used when retrieving a sequence of dead letters.
|
JpaSequencedDeadLetterQueue.Builder<T> |
serializer(Serializer serializer)
Sets the
Serializer to deserialize the events, metadata and diagnostics of the DeadLetter
when storing it to a database. |
JpaSequencedDeadLetterQueue.Builder<T> |
transactionManager(TransactionManager transactionManager)
Sets the
TransactionManager used to manage transaction around fetching event data. |
protected void |
validate()
Validate whether the fields contained in this Builder are set accordingly.
|
public JpaSequencedDeadLetterQueue.Builder<T> processingGroup(String processingGroup)
processingGroup
- The processing group of this SequencedDeadLetterQueue
.public JpaSequencedDeadLetterQueue.Builder<T> maxSequences(int maxSequences)
SequencedDeadLetterQueue
may contain.
The given maxSequences
is required to be a positive number, higher or equal to 128
. It
defaults to 1024
.
maxSequences
- The maximum amount of unique sequences for the queue under construction.public JpaSequencedDeadLetterQueue.Builder<T> maxSequenceSize(int maxSequenceSize)
letters
per unique sequences this
SequencedDeadLetterQueue
can store.
The given maxSequenceSize
is required to be a positive number, higher or equal to 128
. It
defaults to 1024
.
maxSequenceSize
- The maximum amount of letters
per unique sequence.public JpaSequencedDeadLetterQueue.Builder<T> entityManagerProvider(EntityManagerProvider entityManagerProvider)
EntityManagerProvider
which provides the EntityManager
used to access the underlying
database for this JpaSequencedDeadLetterQueue
implementation.entityManagerProvider
- a EntityManagerProvider
which provides the EntityManager
used to
access the underlying databasepublic JpaSequencedDeadLetterQueue.Builder<T> transactionManager(TransactionManager transactionManager)
TransactionManager
used to manage transaction around fetching event data. Required by
certain databases for reading blob data.transactionManager
- a TransactionManager
used to manage transaction around fetching event datapublic JpaSequencedDeadLetterQueue.Builder<T> serializer(Serializer serializer)
Serializer
to deserialize the events, metadata and diagnostics of the DeadLetter
when storing it to a database.serializer
- The serializer to usepublic JpaSequencedDeadLetterQueue.Builder<T> eventSerializer(Serializer serializer)
Serializer
to (de)serialize the event payload, event metadata, and diagnostics of the
DeadLetter
when storing it to the database.serializer
- The serializer to usepublic JpaSequencedDeadLetterQueue.Builder<T> genericSerializer(Serializer serializer)
Serializer
to (de)serialize the tracking token of the event in the DeadLetter
when
storing it to the database.serializer
- The serializer to usepublic JpaSequencedDeadLetterQueue.Builder<T> clearConverters()
EventMessageDeadLetterJpaConverter
.public JpaSequencedDeadLetterQueue.Builder<T> addConverter(DeadLetterJpaConverter<EventMessage<?>> converter)
DeadLetterJpaConverter
to the configuration, which is used to deserialize dead-letter entries
from the database.public JpaSequencedDeadLetterQueue.Builder<T> claimDuration(Duration claimDuration)
JpaSequencedDeadLetterQueue.process(Predicate, Function)
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.
claimDuration
- The longest claim duration allowed.public JpaSequencedDeadLetterQueue.Builder<T> queryPageSize(int queryPageSize)
100
items in a
page.queryPageSize
- The page sizepublic JpaSequencedDeadLetterQueue<T> build()
JpaSequencedDeadLetterQueue
as specified through this Builder.JpaSequencedDeadLetterQueue
as specified through this Builder.protected void validate()
AxonConfigurationException
- When one field asserts to be incorrect according to the Builder's
specifications.Copyright © 2010–2024. All rights reserved.