Class JdbcEventStorageEngine
- All Implemented Interfaces:
EventStorageEngine
EventStorageEngine implementation that uses JDBC to store and
fetch events.
By default, it stores the payload of events as a serialized blob of bytes. It uses other columns to store meta-data that allows quick finding of DomainEvents for a specific aggregate in the correct order.
Before using this store make sure the database contains a table named EventSchema.domainEventTable() and
EventSchema.snapshotTable() in which to store events and snapshots in respectively. For convenience, these
tables can be constructed through the createSchema(EventTableFactory) operation.
- Since:
- 3.0
- Author:
- Rene de Waele
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate aJdbcEventStorageEngine. -
Field Summary
Fields inherited from class org.axonframework.eventsourcing.eventstore.AbstractEventStorageEngine
upcasterChain -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate aJdbcEventStorageEnginebased on the fields contained in theJdbcEventStorageEngine.Builder. -
Method Summary
Modifier and TypeMethodDescriptionprotected PreparedStatementappendEvents(Connection connection, List<? extends EventMessage<?>> events, Serializer serializer) Creates a statement to be used atappendEvents(List, Serializer).protected voidappendEvents(List<? extends EventMessage<?>> events, Serializer serializer) Append giveneventsto the backing database.protected PreparedStatementappendSnapshot(Connection connection, DomainEventMessage<?> snapshot, Serializer serializer) Creates a statement to be used atAbstractEventStorageEngine.storeSnapshot(DomainEventMessage).builder()Instantiate a Builder to be able to create aJdbcEventStorageEngine.protected PreparedStatementcleanGaps(Connection connection, SortedSet<Long> gaps) Creates a statement to be used atcleanGaps(TrackingToken).Creates a token that is at the head of an event stream - that tracks all new events.protected PreparedStatementcreateHeadToken(Connection connection) Creates a statement to be used atcreateHeadToken().voidcreateSchema(EventTableFactory schemaFactory) Performs the DDL queries to create the schema necessary for this storage engine implementation.Creates a token that is at the tail of an event stream - that tracks events from the beginning of time.protected PreparedStatementcreateTailToken(Connection connection) Creates a statement to be used atcreateTailToken().protected PreparedStatementcreateTokenAt(Connection connection, Instant dateTime) Creates a statement to be used atcreateTokenAt(Instant).createTokenAt(Instant dateTime) Creates a token that tracks all events after givendateTime.protected PreparedStatementdeleteSnapshots(Connection connection, String aggregateIdentifier, long sequenceNumber) Creates a statement to be used atAbstractEventStorageEngine.storeSnapshot(DomainEventMessage).protected StringDeprecated.protected List<? extends DomainEventData<?>> fetchDomainEvents(String aggregateIdentifier, long firstSequenceNumber, int batchSize) Returns a batch of events published by an aggregate with givenaggregateIdentifier.protected booleanSpecifies whether theBatchingEventStorageEngine.readEventData(String, long)should proceed fetching events for an aggregate until an empty batch is returned.protected PreparedStatementfetchTrackedEvents(Connection connection, long index) Creates a statement to be used atfetchTrackedEvents(TrackingToken, int).protected List<? extends TrackedEventData<?>> fetchTrackedEvents(TrackingToken lastToken, int batchSize) Returns a batch of serialized event data entries in the event storage that have aTrackingTokengreater than the givenlastToken.protected ConnectionReturns aConnectionto the database.protected DomainEventData<?> getDomainEventData(ResultSet resultSet) Extracts the next domain event entry from the givenresultSet.protected DomainEventData<?> getSnapshotData(ResultSet resultSet) Extracts the next snapshot entry from the givenresultSet.protected TrackedEventData<?> getTrackedEventData(ResultSet resultSet, GapAwareTrackingToken previousToken) Extracts the next tracked event entry from the givenresultSet.lastSequenceNumberFor(String aggregateIdentifier) Returns the last known sequence number for the givenaggregateIdentifier.protected PreparedStatementlastSequenceNumberFor(Connection connection, String aggregateIdentifier) Creates a statement to be used atlastSequenceNumberFor(String).protected PreparedStatementreadEventData(Connection connection, String identifier, long firstSequenceNumber, int batchSize) Creates a statement to be used atfetchDomainEvents(String, long, int)protected PreparedStatementreadEventData(Connection connection, TrackingToken lastToken, int batchSize) Creates a statement to read tracked event entries stored since given tracking token.protected PreparedStatementreadEventDataWithGaps(Connection connection, long globalIndex, int batchSize, List<Long> gaps) Creates a statement to be used atfetchTrackedEvents(TrackingToken, int)protected PreparedStatementreadEventDataWithoutGaps(Connection connection, long globalIndex, int batchSize) Creates a statement to be used atfetchTrackedEvents(TrackingToken, int)protected <T> TreadPayload(ResultSet resultSet, String columnName) Reads a serialized object from the givenresultSetat givencolumnIndex.protected Stream<? extends DomainEventData<?>> readSnapshotData(String aggregateIdentifier) Returns a stream of serialized event entries for givenaggregateIdentifierif the backing database contains a snapshot of the aggregate.protected PreparedStatementreadSnapshotData(Connection connection, String identifier) Creates a statement to be used atreadSnapshotData(String).protected ObjectreadTimeStamp(ResultSet resultSet, String columnName) Reads a timestamp from the givenresultSetat givencolumnIndex.protected EventSchemaschema()Returns theEventSchemathat defines the table and column names of event tables in the database.voidsetGapCleaningThreshold(int gapCleaningThreshold) Deprecated.Use thegapCleaningThreshold(int)in thebuilder()insteadvoidsetGapTimeout(int gapTimeout) Deprecated.Use thegapTimeout(int)in thebuilder()insteadprotected voidstoreSnapshot(DomainEventMessage<?> snapshot, Serializer serializer) Store the givensnapshotof an Aggregate.protected StringDeprecated.in favor ofEventSchema.trackedEventFields()protected voidwriteTimestamp(PreparedStatement preparedStatement, int position, Instant timestamp) Write a timestamp from aInstantto a data value suitable for the database scheme.Methods inherited from class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine
batchSize, readEventData, readEventDataMethods inherited from class org.axonframework.eventsourcing.eventstore.AbstractEventStorageEngine
appendEvents, getEventSerializer, getSnapshotSerializer, handlePersistenceException, readEvents, readEvents, readSnapshot, storeSnapshotMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.eventsourcing.eventstore.EventStorageEngine
appendEvents, readEvents
-
Constructor Details
-
JdbcEventStorageEngine
Instantiate aJdbcEventStorageEnginebased on the fields contained in theJdbcEventStorageEngine.Builder.Will assert that the event and snapshot
Serializer, theConnectionProviderandTransactionManagerare notnull, and will throw anAxonConfigurationExceptionif any of them isnull.- Parameters:
builder- theJdbcEventStorageEngine.Builderused to instantiate aJdbcEventStorageEngineinstance
-
-
Method Details
-
builder
Instantiate a Builder to be able to create aJdbcEventStorageEngine.The following configurable fields have defaults:
- The
EventUpcasterdefaults to anNoOpEventUpcaster. - The
PersistenceExceptionResolveris defaulted to aJdbcSQLErrorCodesResolver - The
snapshotFilterdefaults to aSnapshotFilter.allowAll()instance. - The
batchSizedefaults to an integer of size100. - The
dataTypeis defaulted to thebyte[]type. - The
EventSchemadefaults to anEventSchema()call. - The
maxGapOffsetdefaults to an integer of size10000. - The
lowestGlobalSequencedefaults to a long of size1. - The
gapTimeoutdefaults to an integer of size60000(1 minute). - The
gapCleaningThresholddefaults to an integer of size250. - The
extendedGapCheckEnableddefaults totrue. - The
createTokenAtdefaults toJdbcEventStorageEngineStatements.createTokenAt(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, java.time.Instant). - The
appendEventsdefaults toJdbcEventStorageEngineStatements.appendEvents(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, java.lang.Class<?>, java.util.List<? extends org.axonframework.eventhandling.EventMessage<?>>, org.axonframework.serialization.Serializer, org.axonframework.eventsourcing.eventstore.jdbc.statements.TimestampWriter). - The
lastSequenceNumberFordefaults toJdbcEventStorageEngineStatements.lastSequenceNumberFor(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, java.lang.String). - The
createTailTokendefaults toJdbcEventStorageEngineStatements.createTailToken(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema). - The
createHeadTokendefaults toJdbcEventStorageEngineStatements.createHeadToken(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema). - The
appendSnapshotdefaults toJdbcEventStorageEngineStatements.appendSnapshot(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, java.lang.Class<?>, org.axonframework.eventhandling.DomainEventMessage<?>, org.axonframework.serialization.Serializer, org.axonframework.eventsourcing.eventstore.jdbc.statements.TimestampWriter). - The
deleteSnapshotsdefaults toJdbcEventStorageEngineStatements.deleteSnapshots(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, java.lang.String, long). - The
fetchTrackedEventsdefaults toJdbcEventStorageEngineStatements.fetchTrackedEvents(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, long). - The
cleanGapsdefaults toJdbcEventStorageEngineStatements.cleanGaps(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, java.util.SortedSet<java.lang.Long>). - The
readEventDataForAggregatedefaults toJdbcEventStorageEngineStatements.readEventDataForAggregate(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, java.lang.String, long, int). - The
readSnapshotDatadefaults toJdbcEventStorageEngineStatements.readSnapshotData(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, java.lang.String). - The
readEventDataWithoutGapsdefaults toJdbcEventStorageEngineStatements.readEventDataWithoutGaps(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, long, int). - The
readEventDataWithGapsdefaults toJdbcEventStorageEngineStatements.readEventDataWithGaps(java.sql.Connection, org.axonframework.eventsourcing.eventstore.jdbc.EventSchema, long, int, java.util.List<java.lang.Long>).
The event and snapshot
Serializer,ConnectionProviderandTransactionManagerare hard requirements and as such should be provided.- Returns:
- a Builder to be able to create a
JdbcEventStorageEngine
- The
-
createTokenAt
protected PreparedStatement createTokenAt(Connection connection, Instant dateTime) throws SQLException Creates a statement to be used atcreateTokenAt(Instant).- Parameters:
connection- The connection to the database.dateTime- The dateTime where the token will be created.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
appendEvents
protected PreparedStatement appendEvents(Connection connection, List<? extends EventMessage<?>> events, Serializer serializer) throws SQLException Creates a statement to be used atappendEvents(List, Serializer).- Parameters:
connection- The connection to the database.events- The events to be added.serializer- The serializer for the payload and metadata.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
lastSequenceNumberFor
protected PreparedStatement lastSequenceNumberFor(Connection connection, String aggregateIdentifier) throws SQLException Creates a statement to be used atlastSequenceNumberFor(String).- Parameters:
connection- The connection to the database.aggregateIdentifier- The identifier of the aggregate.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
createTailToken
Creates a statement to be used atcreateTailToken().- Parameters:
connection- The connection to the database.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
createHeadToken
Creates a statement to be used atcreateHeadToken().- Parameters:
connection- The connection to the database.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
appendSnapshot
protected PreparedStatement appendSnapshot(Connection connection, DomainEventMessage<?> snapshot, Serializer serializer) throws SQLException Creates a statement to be used atAbstractEventStorageEngine.storeSnapshot(DomainEventMessage).- Parameters:
connection- The connection to the database.snapshot- The snapshot to be appended.serializer- The serializer for the payload and metadata.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
deleteSnapshots
protected PreparedStatement deleteSnapshots(Connection connection, String aggregateIdentifier, long sequenceNumber) throws SQLException Creates a statement to be used atAbstractEventStorageEngine.storeSnapshot(DomainEventMessage).- Parameters:
connection- The connection to the database.aggregateIdentifier- The identifier of the aggregate taken from the snapshot.sequenceNumber- The sequence number taken from the snapshot.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
fetchTrackedEvents
protected PreparedStatement fetchTrackedEvents(Connection connection, long index) throws SQLException Creates a statement to be used atfetchTrackedEvents(TrackingToken, int).- Parameters:
connection- The connection to the database.index- The index taken from the tracking token.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
cleanGaps
protected PreparedStatement cleanGaps(Connection connection, SortedSet<Long> gaps) throws SQLException Creates a statement to be used atcleanGaps(TrackingToken).- Parameters:
connection- The connection to the database.gaps- The Set of gaps taken from the tracking token.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
readEventData
protected PreparedStatement readEventData(Connection connection, String identifier, long firstSequenceNumber, int batchSize) throws SQLException Creates a statement to be used atfetchDomainEvents(String, long, int)- Parameters:
connection- The connection to the database.identifier- The identifier of the aggregate.firstSequenceNumber- The expected sequence number of the first returned entry.batchSize- The number of items to include in the batch.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
readSnapshotData
protected PreparedStatement readSnapshotData(Connection connection, String identifier) throws SQLException Creates a statement to be used atreadSnapshotData(String).- Parameters:
connection- The connection to the database.identifier- The identifier of the aggregate.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
readEventDataWithoutGaps
protected PreparedStatement readEventDataWithoutGaps(Connection connection, long globalIndex, int batchSize) throws SQLException Creates a statement to be used atfetchTrackedEvents(TrackingToken, int)- Parameters:
connection- The connection to the database.globalIndex- The index taken from the tracking token.batchSize- The number of items to include in the batch- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
readEventDataWithGaps
protected PreparedStatement readEventDataWithGaps(Connection connection, long globalIndex, int batchSize, List<Long> gaps) throws SQLException Creates a statement to be used atfetchTrackedEvents(TrackingToken, int)- Parameters:
connection- The connection to the database.globalIndex- The index taken from the tracking token.batchSize- The number of items to include in the batchgaps- The Set of gaps taken from the tracking token.- Returns:
- The newly created
PreparedStatement. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
createSchema
Performs the DDL queries to create the schema necessary for this storage engine implementation.- Parameters:
schemaFactory- Factory of the event schema.- Throws:
EventStoreException- when an error occurs executing SQL statements.
-
appendEvents
Description copied from class:AbstractEventStorageEngineAppend giveneventsto the backing database. Use the givenserializerto serialize the event's payload and metadata.- Specified by:
appendEventsin classAbstractEventStorageEngine- Parameters:
events- Events to append to the databaseserializer- Serializer used to convert the events to a suitable format for storage
-
storeSnapshot
Description copied from class:AbstractEventStorageEngineStore the givensnapshotof an Aggregate. Implementations may override any existing snapshot of the Aggregate with the given snapshot.- Specified by:
storeSnapshotin classAbstractEventStorageEngine- Parameters:
snapshot- Snapshot Event of the aggregateserializer- Serializer used to convert the snapshot event to a suitable format for storage
-
lastSequenceNumberFor
Description copied from interface:EventStorageEngineReturns the last known sequence number for the givenaggregateIdentifier.While it's recommended to use the sequence numbers from the
DomainEventStream, there are cases where knowing the sequence number is required, without having read the actual events. In such case, this method is a viable alternative.- Parameters:
aggregateIdentifier- The identifier to find the last sequence number for- Returns:
- an optional with the highest sequence number, or an empty optional if the aggregate identifier wasn't found
-
createTailToken
Description copied from interface:EventStorageEngineCreates a token that is at the tail of an event stream - that tracks events from the beginning of time.- Returns:
- a tracking token at the tail of an event stream, if event stream is empty
nullis returned
-
createHeadToken
Description copied from interface:EventStorageEngineCreates a token that is at the head of an event stream - that tracks all new events.- Returns:
- a tracking token at the head of an event stream, if event stream is empty
nullis returned
-
createTokenAt
Description copied from interface:EventStorageEngineCreates a token that tracks all events after givendateTime. If there is an event exactly at the givendateTime, it will be tracked too.- Parameters:
dateTime- The date and time for determining criteria how the tracking token should be created. A tracking token should point to very first event before this date and time.- Returns:
- a tracking token at the given
dateTime, if there aren't events matching this criterianullis returned
-
fetchDomainEvents
protected List<? extends DomainEventData<?>> fetchDomainEvents(String aggregateIdentifier, long firstSequenceNumber, int batchSize) Description copied from class:BatchingEventStorageEngineReturns a batch of events published by an aggregate with givenaggregateIdentifier. The sequence numbers in the returned batch should be ordered by sequence number. The first event in the batch should have a sequence number equal to or larger than givenfirstSequenceNumber. Implementations should make sure the returned batch does not contain gaps between events due to uncommitted storage transactions. If the returned number of entries is smaller than the givenbatchSizeit is assumed that the storage holds no further applicable entries. Implementations for which this is not always the case should overrideBatchingEventStorageEngine.fetchForAggregateUntilEmpty()to returntrueand preferably configure a betterBatchingEventStorageEngine.Builder.finalAggregateBatchPredicate(Predicate)to provide a better heuristic for detecting the last batch in a stream.- Specified by:
fetchDomainEventsin classBatchingEventStorageEngine- Parameters:
aggregateIdentifier- The identifier of the aggregate to open a stream forfirstSequenceNumber- The sequence number of the first excepted event entrybatchSize- The maximum number of events that should be returned- Returns:
- a batch of serialized event entries for the given aggregate
-
fetchForAggregateUntilEmpty
protected boolean fetchForAggregateUntilEmpty()Description copied from class:BatchingEventStorageEngineSpecifies whether theBatchingEventStorageEngine.readEventData(String, long)should proceed fetching events for an aggregate until an empty batch is returned. Defaults tofalse, as Aggregate event batches typically do not have gaps in them.- Overrides:
fetchForAggregateUntilEmptyin classBatchingEventStorageEngine- Returns:
- a
booleanspecifying whetherBatchingEventStorageEngine.readEventData(String, long)should proceed fetching events for an aggregate until an empty batch is returned
-
fetchTrackedEvents
protected List<? extends TrackedEventData<?>> fetchTrackedEvents(TrackingToken lastToken, int batchSize) Description copied from class:BatchingEventStorageEngineReturns a batch of serialized event data entries in the event storage that have aTrackingTokengreater than the givenlastToken. Event entries in the stream should be ordered by tracking token. If thelastTokenisnulla stream containing all events should be returned.Only if the returned List is empty the event storage assumes that the backing database holds no further applicable entries.
- Specified by:
fetchTrackedEventsin classBatchingEventStorageEngine- Parameters:
lastToken- Object describing the global index of the last processed event ornullto create a stream of all events in the storebatchSize- The maximum number of events that should be returned- Returns:
- A batch of tracked event messages stored since the given tracking token
-
readSnapshotData
Description copied from class:AbstractEventStorageEngineReturns a stream of serialized event entries for givenaggregateIdentifierif the backing database contains a snapshot of the aggregate.It is required that specific event storage engines return snapshots in descending order of their sequence number.
- Specified by:
readSnapshotDatain classAbstractEventStorageEngine- Parameters:
aggregateIdentifier- The aggregate identifier to fetch a snapshot for- Returns:
- A stream of serialized snapshots of the aggregate
-
readEventData
protected PreparedStatement readEventData(Connection connection, TrackingToken lastToken, int batchSize) throws SQLException Creates a statement to read tracked event entries stored since given tracking token. Pass atrackingTokenofnullto create a statement for all entries in the storage.- Parameters:
connection- The connection to the database.lastToken- Object describing the global index of the last processed event ornullto return all entries in the store.batchSize- The number of items to include in the batch- Returns:
- A
PreparedStatementthat returns event entries for the given query when executed. - Throws:
SQLException- when an exception occurs while creating the prepared statement.
-
getTrackedEventData
protected TrackedEventData<?> getTrackedEventData(ResultSet resultSet, GapAwareTrackingToken previousToken) throws SQLException Extracts the next tracked event entry from the givenresultSet.- Parameters:
resultSet- The results of a query for tracked events.previousToken- The last known token of the tracker before obtaining this result set.- Returns:
- The next tracked event.
- Throws:
SQLException- when an exception occurs while creating the event data.
-
getDomainEventData
Extracts the next domain event entry from the givenresultSet.- Parameters:
resultSet- The results of a query for domain events of an aggregate.- Returns:
- The next domain event.
- Throws:
SQLException- when an exception occurs while creating the event data.
-
getSnapshotData
Extracts the next snapshot entry from the givenresultSet.- Parameters:
resultSet- The results of a query for a snapshot of an aggregate.- Returns:
- The next snapshot data.
- Throws:
SQLException- when an exception occurs while creating the event data.
-
readTimeStamp
Reads a timestamp from the givenresultSetat givencolumnIndex. The resultSet is positioned in the row that contains the data. This method must not change the row in the result set.- Parameters:
resultSet- The resultSet containing the stored data.columnName- The name of the column containing the timestamp.- Returns:
- an object describing the timestamp.
- Throws:
SQLException- when an exception occurs reading from the resultSet.
-
writeTimestamp
protected void writeTimestamp(PreparedStatement preparedStatement, int position, Instant timestamp) throws SQLException Write a timestamp from aInstantto a data value suitable for the database scheme.- Parameters:
preparedStatement- the statement to update.position- the position of the timestamp parameter in the statement.timestamp-Instantto convert.- Throws:
SQLException- if modification of the statement fails.
-
readPayload
Reads a serialized object from the givenresultSetat givencolumnIndex. The resultSet is positioned in the row that contains the data. This method must not change the row in the result set.- Parameters:
resultSet- The resultSet containing the stored data.columnName- The name of the column containing the payload.- Returns:
- an object describing the serialized data.
- Throws:
SQLException- when an exception occurs reading from the resultSet.
-
domainEventFields
Deprecated.in favor ofEventSchema.domainEventFields()Returns a comma separated list of domain event column names to select from an event or snapshot entry.- Returns:
- comma separated domain event column names.
-
trackedEventFields
Deprecated.in favor ofEventSchema.trackedEventFields()Returns a comma separated list of tracked domain event column names to select from an event entry.- Returns:
- comma separated tracked domain event column names.
-
schema
Returns theEventSchemathat defines the table and column names of event tables in the database.- Returns:
- the event schema.
-
getConnection
Returns aConnectionto the database.- Returns:
- a database Connection.
-
setGapTimeout
Deprecated.Use thegapTimeout(int)in thebuilder()insteadSets the amount of time until a 'gap' in a TrackingToken may be considered timed out. This setting will affect the cleaning process of gaps. Gaps that have timed out will be removed from Tracking Tokens to improve performance of reading events. Defaults to 60000 (1 minute).- Parameters:
gapTimeout- The amount of time, in milliseconds until a gap may be considered timed out.
-
setGapCleaningThreshold
Deprecated.Use thegapCleaningThreshold(int)in thebuilder()insteadSets the threshold of number of gaps in a token before an attempt to clean gaps up is taken. Defaults to 250.- Parameters:
gapCleaningThreshold- The number of gaps before triggering a cleanup.
-
EventSchema.domainEventFields()