E
- An implementation of EventMessage
within the DeadLetter
this factory constructs
PreparedStatements
for.public interface DeadLetterStatementFactory<E extends EventMessage<?>>
PreparedStatements
a JdbcSequencedDeadLetterQueue
requires to function.Modifier and Type | Method and Description |
---|---|
PreparedStatement |
amountOfSequencesStatement(Connection connection,
String processingGroup)
Constructs the
PreparedStatement used for the JdbcSequencedDeadLetterQueue.amountOfSequences()
operation. |
PreparedStatement |
claimableSequencesStatement(Connection connection,
String processingGroup,
Instant processingStartedLimit,
int offset,
int maxSize)
Constructs the
PreparedStatement used to retrieve the identifiers of the first entries of each sequence
with that can be claimed. |
PreparedStatement |
claimStatement(Connection connection,
String identifier,
Instant current,
Instant processingStartedLimit)
Constructs the
PreparedStatement used to claim a DeadLetter entry. |
PreparedStatement |
clearStatement(Connection connection,
String processingGroup)
Constructs the
PreparedStatement used for the clear
operation. |
PreparedStatement |
containsStatement(Connection connection,
String processingGroup,
String sequenceIdentifier)
Constructs the
PreparedStatement used for the JdbcSequencedDeadLetterQueue.contains(Object)
operation. |
PreparedStatement |
enqueueStatement(Connection connection,
String processingGroup,
String sequenceIdentifier,
DeadLetter<? extends E> letter,
long sequenceIndex)
Constructs the
PreparedStatement used for the
JdbcSequencedDeadLetterQueue.enqueue(Object, DeadLetter) operation. |
PreparedStatement |
evictStatement(Connection connection,
String identifier)
Constructs the
PreparedStatement used for the JdbcSequencedDeadLetterQueue.evict(DeadLetter)
operation. |
PreparedStatement |
letterSequenceStatement(Connection connection,
String processingGroup,
String sequenceIdentifier,
int offset,
int maxSize)
Constructs the
PreparedStatement used for the
JdbcSequencedDeadLetterQueue.deadLetterSequence(Object) operation. |
PreparedStatement |
maxIndexStatement(Connection connection,
String processingGroup,
String sequenceIdentifier)
Constructs the
PreparedStatement used to retrieve the maximum
index of the sequence identified with the given
sequenceIdentifier . |
PreparedStatement |
nextLetterInSequenceStatement(Connection connection,
String processingGroup,
String sequenceIdentifier,
long sequenceIndex)
Constructs the
PreparedStatement used to retrieve the following DeadLetter from the sequence
identified with the given sequenceIdentifier . |
PreparedStatement |
requeueStatement(Connection connection,
String identifier,
Cause cause,
Instant lastTouched,
MetaData diagnostics)
Constructs the
PreparedStatement used for the
JdbcSequencedDeadLetterQueue.requeue(DeadLetter, UnaryOperator) operation. |
PreparedStatement |
sequenceIdentifiersStatement(Connection connection,
String processingGroup)
Constructs the
PreparedStatement used to iterate over all sequences contained in the queue for the
JdbcSequencedDeadLetterQueue.deadLetters() operation. |
PreparedStatement |
sequenceSizeStatement(Connection connection,
String processingGroup,
String sequenceIdentifier)
Constructs the
PreparedStatement used for the JdbcSequencedDeadLetterQueue.sequenceSize(Object)
operation. |
PreparedStatement |
sizeStatement(Connection connection,
String processingGroup)
Constructs the
PreparedStatement used for the JdbcSequencedDeadLetterQueue.size() operation. |
PreparedStatement enqueueStatement(@Nonnull Connection connection, @Nonnull String processingGroup, @Nonnull String sequenceIdentifier, @Nonnull DeadLetter<? extends E> letter, long sequenceIndex) throws SQLException
PreparedStatement
used for the
JdbcSequencedDeadLetterQueue.enqueue(Object, DeadLetter)
operation.connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to enqueue the given letter
.sequenceIdentifier
- The identifier of the sequence the letter belongs to.letter
- The letter to enqueue.sequenceIndex
- The index of the letter within the sequence, to ensure the processing order is
maintained.PreparedStatement
used to
enqueue
.SQLException
- When the statement could not be created.PreparedStatement maxIndexStatement(@Nonnull Connection connection, @Nonnull String processingGroup, @Nonnull String sequenceIdentifier) throws SQLException
PreparedStatement
used to retrieve the maximum
index
of the sequence identified with the given
sequenceIdentifier
.
Used by the JdbcSequencedDeadLetterQueue.enqueue(Object, DeadLetter)
to deduce the index of the
DeadLetter
in its sequence.
connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to retrieve the maximum
index
of the sequence identified through
the given sequenceIdentifier
.sequenceIdentifier
- The identifier of the sequence for which to retrieve the maximum
index
for.PreparedStatement
used to retrieve the maximum
index
with.SQLException
- When the statement could not be created.PreparedStatement evictStatement(@Nonnull Connection connection, @Nonnull String identifier) throws SQLException
PreparedStatement
used for the JdbcSequencedDeadLetterQueue.evict(DeadLetter)
operation.connection
- The Connection
used to create the PreparedStatement
.identifier
- The identifier of the DeadLetter
to evict.PreparedStatement
used to evict
.SQLException
- When the statement could not be created.PreparedStatement requeueStatement(@Nonnull Connection connection, @Nonnull String identifier, Cause cause, @Nonnull Instant lastTouched, MetaData diagnostics) throws SQLException
PreparedStatement
used for the
JdbcSequencedDeadLetterQueue.requeue(DeadLetter, UnaryOperator)
operation.connection
- The Connection
used to create the PreparedStatement
.identifier
- The identifier of the DeadLetter
to requeue.cause
- The cause of requeueing the DeadLetter
identified through the given
identifier
.lastTouched
- The Instant
the DeadLetter
to requeue was last processed.diagnostics
- The new diagnostics to attach to the DeadLetter
to requeue.PreparedStatement
used to
requeue
.SQLException
- When the statement could not be created.PreparedStatement containsStatement(@Nonnull Connection connection, @Nonnull String processingGroup, @Nonnull String sequenceIdentifier) throws SQLException
PreparedStatement
used for the JdbcSequencedDeadLetterQueue.contains(Object)
operation.connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to check whether the sequence identified by the given
sequenceIdentifier
.sequenceIdentifier
- The identifier of the sequence to validate whether it is contained in the queue.PreparedStatement
used to check whether the given sequenceIdentifier
is
contained
in the queue.SQLException
- When the statement could not be created.PreparedStatement letterSequenceStatement(@Nonnull Connection connection, @Nonnull String processingGroup, @Nonnull String sequenceIdentifier, int offset, int maxSize) throws SQLException
PreparedStatement
used for the
JdbcSequencedDeadLetterQueue.deadLetterSequence(Object)
operation.
As dead-letter sequences can be large, the JdbcSequencedDeadLetterQueue
assumes it needs to page through
the result set. To that end it is recommended to use the given offset
to define the starting point of the
query (for example by validate the DeadLetterSchema.sequenceIndexColumn()
). The given maxSize
can
be used to limit the result.
connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to retrieve a dead-letter sequence.sequenceIdentifier
- The identifier of the sequence to retrieve.offset
- The offset from where to start the PreparedStatement
under construction.maxSize
- The maximum size to limit the PreparedStatement
under construction.PreparedStatement
used to return the dead letter sequence for the given
sequenceIdentifier
with.SQLException
- When the statement could not be created.PreparedStatement sequenceIdentifiersStatement(@Nonnull Connection connection, @Nonnull String processingGroup) throws SQLException
PreparedStatement
used to iterate over all sequences contained in the queue for the
JdbcSequencedDeadLetterQueue.deadLetters()
operation.connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to retrieve all sequence identifiers.PreparedStatement
used to return all sequence identifiers enqueued in the given
processingGroup
with.SQLException
- When the statement could not be created.PreparedStatement sizeStatement(@Nonnull Connection connection, @Nonnull String processingGroup) throws SQLException
PreparedStatement
used for the JdbcSequencedDeadLetterQueue.size()
operation.connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to retrieve the size for.PreparedStatement
used to retrieve the size with.SQLException
- When the statement could not be created.PreparedStatement sequenceSizeStatement(@Nonnull Connection connection, @Nonnull String processingGroup, @Nonnull String sequenceIdentifier) throws SQLException
PreparedStatement
used for the JdbcSequencedDeadLetterQueue.sequenceSize(Object)
operation.connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to retrieve the size of the identified sequence.sequenceIdentifier
- The identifier of the sequence for which to retrieve the size.PreparedStatement
used to retrieve the size of the sequence identified by the given
sequenceIdentifier
with.SQLException
- When the statement could not be created.PreparedStatement amountOfSequencesStatement(@Nonnull Connection connection, @Nonnull String processingGroup) throws SQLException
PreparedStatement
used for the JdbcSequencedDeadLetterQueue.amountOfSequences()
operation.connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to retrieve the amount of sequences.PreparedStatement
used to retrieve the amount of sequences with.SQLException
- When the statement could not be created.PreparedStatement claimableSequencesStatement(@Nonnull Connection connection, @Nonnull String processingGroup, @Nonnull Instant processingStartedLimit, int offset, int maxSize) throws SQLException
PreparedStatement
used to retrieve the identifiers of the first entries of each sequence
with that can be claimed.
Used by the JdbcSequencedDeadLetterQueue.process(Function)
and
JdbcSequencedDeadLetterQueue.process(Predicate, Function)
operations. A row may be claimed if the
processing started
field is older than the given
processingStartedLimit
.
The amount of sequences in a queue can be vast, hence the JdbcSequencedDeadLetterQueue
assumes it needs
to page through the result set. To that end it is recommended to use the given offset
to define the
starting point of the query (for example by validate the DeadLetterSchema.sequenceIndexColumn()
). The
given maxSize
can be used to limit the result.
connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group to find claimable sequences for.processingStartedLimit
- The Instant
used to compare with the
processing started
field.offset
- The offset from where to start the PreparedStatement
under construction.maxSize
- The maximum size to limit the PreparedStatement
under construction.PreparedStatement
used to find the identifier of the first entries of each sequence that are
claimable.SQLException
- When the statement could not be created.PreparedStatement claimStatement(@Nonnull Connection connection, @Nonnull String identifier, @Nonnull Instant current, @Nonnull Instant processingStartedLimit) throws SQLException
PreparedStatement
used to claim a DeadLetter
entry.
Claiming a DeadLetter
ensures only a single thread
processes
the DeadLetter
. This operation typically
updates the processing started
field with the given
current
Instant
, marking it as claimed for a certain timeframe.
The returned statement is used after the JdbcSequencedDeadLetterQueue
searched for
claimable sequences
during a
JdbcSequencedDeadLetterQueue.process(Function)
or
JdbcSequencedDeadLetterQueue.process(Predicate, Function)
invocation.
connection
- The Connection
used to create the PreparedStatement
.identifier
- The identifier of the DeadLetter
to claim.current
- The Instant
used to update the
processing started
field with to
mark it as claimed.processingStartedLimit
- The Instant
used to compare with the
processing started
field, to
ensure it wasn't claimed by another process.PreparedStatement
used to claim a DeadLetter
with for
processing
, ensuring no two threads are processing the
same letter.SQLException
- When the statement could not be created.PreparedStatement nextLetterInSequenceStatement(@Nonnull Connection connection, @Nonnull String processingGroup, @Nonnull String sequenceIdentifier, long sequenceIndex) throws SQLException
PreparedStatement
used to retrieve the following DeadLetter
from the sequence
identified with the given sequenceIdentifier
. The returned statement is used after the
The returned statement is used after the JdbcSequencedDeadLetterQueue
claimed
a letter and successfully processed
it during a JdbcSequencedDeadLetterQueue.process(Function)
or
JdbcSequencedDeadLetterQueue.process(Predicate, Function)
invocation.
connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to return the following DeadLetter
in the
sequence identified by the given sequenceIdentifier
.sequenceIdentifier
- The identifier of the sequence for which to retrieve the following DeadLetter
for.sequenceIndex
- The index of the letter preceding the following DeadLetter
to retrieve.PreparedStatement
used to retrieve the DeadLetter
in the sequence identified by the
given sequenceIdentifier
with.SQLException
- When the statement could not be created.PreparedStatement clearStatement(@Nonnull Connection connection, @Nonnull String processingGroup) throws SQLException
PreparedStatement
used for the clear
operation.
Will only remove all entries for the given processingGroup
.
connection
- The Connection
used to create the PreparedStatement
.processingGroup
- The processing group for which to clear all entries.PreparedStatement
used to clear
all entries for
the given processingGroup
with.SQLException
- When the statement could not be created.Copyright © 2010–2024. All rights reserved.