@ConditionalOnMissingBean({EventStorageEngine.class, EventStore.class}) @Bean public EventStorageEngine eventStorageEngine(Serializer defaultSerializer, PersistenceExceptionResolver persistenceExceptionResolver, @Qualifier("eventSerializer") Serializer eventSerializer, AxonConfiguration configuration, ConnectionProvider connectionProvider, TransactionManager transactionManager) { return JdbcEventStorageEngine.builder() .snapshotSerializer(defaultSerializer) .upcasterChain(configuration.upcasterChain()) .persistenceExceptionResolver(persistenceExceptionResolver) .eventSerializer(eventSerializer) .connectionProvider(connectionProvider) .transactionManager(transactionManager) .build(); }
/** * Instantiate a Builder to be able to create a {@link JdbcEventStorageEngine}. * <p> * The following configurable fields have defaults: * <ul> * <li>The snapshot {@link Serializer} defaults to {@link org.axonframework.serialization.xml.XStreamSerializer}.</li> * <li>The {@link EventUpcaster} defaults to an {@link org.axonframework.serialization.upcasting.event.NoOpEventUpcaster}.</li> * <li>The {@link PersistenceExceptionResolver} is defaulted to a {@link JdbcSQLErrorCodesResolver}</li> * <li>The event Serializer defaults to a {@link org.axonframework.serialization.xml.XStreamSerializer}.</li> * <li>The {@code snapshotFilter} defaults to a {@link Predicate} which returns {@code true} regardless.</li> * <li>The {@code batchSize} defaults to an integer of size {@code 100}.</li> * <li>The {@code dataType} is defaulted to the {@code byte[]} type.</li> * <li>The {@link EventSchema} defaults to an {@link EventSchema#EventSchema()} call.</li> * <li>The {@code maxGapOffset} defaults to an integer of size {@code 10000}.</li> * <li>The {@code lowestGlobalSequence} defaults to a long of size {@code 1}.</li> * <li>The {@code gapTimeout} defaults to an integer of size {@code 60000} (1 minute).</li> * <li>The {@code gapCleaningThreshold} defaults to an integer of size {@code 250}.</li> * <li>The {@code extendedGapCheckEnabled} defaults to {@code true}.</li> * </ul> * <p> * The {@link ConnectionProvider} and {@link TransactionManager} are <b>hard requirements</b> and as such should * be provided. * * @return a Builder to be able to create a {@link JdbcEventStorageEngine} */ public static Builder builder() { return new Builder(); }
/** * Sets 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 an integer of {@code 60000} * ({@link JdbcEventStorageEngine#DEFAULT_GAP_TIMEOUT}), thus 1 minute. * * @param gapTimeout an {@code int} specifying the amount of time until a 'gap' in a TrackingToken may be * considered timed out * @return the current Builder instance, for fluent interfacing */ public Builder gapTimeout(int gapTimeout) { assertPositive(gapTimeout, "gapTimeout"); this.gapTimeout = gapTimeout; return this; }
@ConditionalOnMissingBean({EventStorageEngine.class, EventStore.class}) @Bean public EventStorageEngine eventStorageEngine(Serializer defaultSerializer, PersistenceExceptionResolver persistenceExceptionResolver, @Qualifier("eventSerializer") Serializer eventSerializer, AxonConfiguration configuration, ConnectionProvider connectionProvider, TransactionManager transactionManager) { return JdbcEventStorageEngine.builder() .snapshotSerializer(defaultSerializer) .upcasterChain(configuration.upcasterChain()) .persistenceExceptionResolver(persistenceExceptionResolver) .eventSerializer(eventSerializer) .connectionProvider(connectionProvider) .transactionManager(transactionManager) .build(); }
/** * Sets the {@code maxGapOffset} specifying the maximum distance in sequence numbers between a missing event and * the event with the highest known index. If the gap is bigger it is assumed that the missing event will not be * committed to the store anymore. This event storage engine will no longer look for those events the next time * a batch is fetched. Defaults to an integer of {@code 10000} * ({@link JdbcEventStorageEngine#DEFAULT_MAX_GAP_OFFSET}. * * @param maxGapOffset an {@code int} specifying the maximum distance in sequence numbers between a missing * event and the event with the highest known index * @return the current Builder instance, for fluent interfacing */ public Builder maxGapOffset(int maxGapOffset) { assertPositive(maxGapOffset, "maxGapOffset"); this.maxGapOffset = maxGapOffset; return this; }
private Builder() { persistenceExceptionResolver(new JdbcSQLErrorCodesResolver()); }
/** * Sets the threshold of number of gaps in a token before an attempt to clean gaps up is taken. Defaults to an * integer of {@code 250} ({@link JdbcEventStorageEngine#DEFAULT_GAP_CLEANING_THRESHOLD}). * * @param gapCleaningThreshold an {@code int} specifying the threshold of number of gaps in a token before an * attempt to clean gaps up is taken * @return the current Builder instance, for fluent interfacing */ public Builder gapCleaningThreshold(int gapCleaningThreshold) { assertPositive(gapCleaningThreshold, "gapCleaningThreshold"); this.gapCleaningThreshold = gapCleaningThreshold; return this; }
/** * Instantiate a Builder to be able to create a {@link JdbcEventStorageEngine}. * <p> * The following configurable fields have defaults: * <ul> * <li>The snapshot {@link Serializer} defaults to {@link org.axonframework.serialization.xml.XStreamSerializer}.</li> * <li>The {@link EventUpcaster} defaults to an {@link org.axonframework.serialization.upcasting.event.NoOpEventUpcaster}.</li> * <li>The {@link PersistenceExceptionResolver} is defaulted to a {@link JdbcSQLErrorCodesResolver}</li> * <li>The event Serializer defaults to a {@link org.axonframework.serialization.xml.XStreamSerializer}.</li> * <li>The {@code snapshotFilter} defaults to a {@link Predicate} which returns {@code true} regardless.</li> * <li>The {@code batchSize} defaults to an integer of size {@code 100}.</li> * <li>The {@code dataType} is defaulted to the {@code byte[]} type.</li> * <li>The {@link EventSchema} defaults to an {@link EventSchema#EventSchema()} call.</li> * <li>The {@code maxGapOffset} defaults to an integer of size {@code 10000}.</li> * <li>The {@code lowestGlobalSequence} defaults to a long of size {@code 1}.</li> * <li>The {@code gapTimeout} defaults to an integer of size {@code 60000} (1 minute).</li> * <li>The {@code gapCleaningThreshold} defaults to an integer of size {@code 250}.</li> * <li>The {@code extendedGapCheckEnabled} defaults to {@code true}.</li> * </ul> * <p> * The {@link ConnectionProvider} and {@link TransactionManager} are <b>hard requirements</b> and as such should * be provided. * * @return a Builder to be able to create a {@link JdbcEventStorageEngine} */ public static Builder builder() { return new Builder(); }
/** * Sets the {@code maxGapOffset} specifying the maximum distance in sequence numbers between a missing event and * the event with the highest known index. If the gap is bigger it is assumed that the missing event will not be * committed to the store anymore. This event storage engine will no longer look for those events the next time * a batch is fetched. Defaults to an integer of {@code 10000} * ({@link JdbcEventStorageEngine#DEFAULT_MAX_GAP_OFFSET}. * * @param maxGapOffset an {@code int} specifying the maximum distance in sequence numbers between a missing * event and the event with the highest known index * @return the current Builder instance, for fluent interfacing */ public Builder maxGapOffset(int maxGapOffset) { assertPositive(maxGapOffset, "maxGapOffset"); this.maxGapOffset = maxGapOffset; return this; }
private Builder() { persistenceExceptionResolver(new JdbcSQLErrorCodesResolver()); }
/** * Sets 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 an integer of {@code 60000} * ({@link JdbcEventStorageEngine#DEFAULT_GAP_TIMEOUT}), thus 1 minute. * * @param gapTimeout an {@code int} specifying the amount of time until a 'gap' in a TrackingToken may be * considered timed out * @return the current Builder instance, for fluent interfacing */ public Builder gapTimeout(int gapTimeout) { assertPositive(gapTimeout, "gapTimeout"); this.gapTimeout = gapTimeout; return this; }
/** * Sets the threshold of number of gaps in a token before an attempt to clean gaps up is taken. Defaults to an * integer of {@code 250} ({@link JdbcEventStorageEngine#DEFAULT_GAP_CLEANING_THRESHOLD}). * * @param gapCleaningThreshold an {@code int} specifying the threshold of number of gaps in a token before an * attempt to clean gaps up is taken * @return the current Builder instance, for fluent interfacing */ public Builder gapCleaningThreshold(int gapCleaningThreshold) { assertPositive(gapCleaningThreshold, "gapCleaningThreshold"); this.gapCleaningThreshold = gapCleaningThreshold; return this; }
public JdbcEventStoreBenchmark(DataSource dataSource, PlatformTransactionManager transactionManager) { super(JdbcEventStorageEngine.builder() .connectionProvider(new UnitOfWorkAwareConnectionProviderWrapper(dataSource::getConnection)) .transactionManager(NoTransactionManager.INSTANCE) .build()); this.dataSource = dataSource; this.transactionManager = transactionManager; }