Class JdbcSagaStore.Builder
java.lang.Object
org.axonframework.modelling.saga.repository.jdbc.JdbcSagaStore.Builder
- Enclosing class:
JdbcSagaStore
Builder class to instantiate a
JdbcSagaStore.
The SagaSqlSchema is defaulted to an GenericSagaSqlSchema.
The ConnectionProvider and Serializer are hard requirements and as such should be
provided.
You can choose to provide a DataSource instead of a ConnectionProvider, but in that case the used
ConnectionProvider will be a DataSourceConnectionProvider wrapped by a UnitOfWorkAwareConnectionProviderWrapper.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aJdbcSagaStoreas specified through this Builder.connectionProvider(ConnectionProvider connectionProvider) Sets theConnectionProviderwhich provides access to a JDBC connection.dataSource(DataSource dataSource) Sets theConnectionProviderby providing aDataSource.serializer(Serializer serializer) Sets theSerializerused to de-/serialize a Saga instance.sqlSchema(SagaSqlSchema sqlSchema) Sets theSagaSqlSchemadefining the SQL operations to execute for thisSagaStoreimplementation.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
connectionProvider
Sets theConnectionProviderwhich provides access to a JDBC connection.- Parameters:
connectionProvider- aConnectionProviderwhich provides access to a JDBC connection- Returns:
- the current Builder instance, for fluent interfacing
-
dataSource
Sets theConnectionProviderby providing aDataSource. The givendataSourcein turn will added to aDataSourceConnectionProvider, which is wrapped by aUnitOfWorkAwareConnectionProviderWrapper. This will provide access to a JDBC connection for thisSagaStoreimplementation.- Parameters:
dataSource- aDataSourcewhich ends up in aDataSourceConnectionProvider, wrapped by aUnitOfWorkAwareConnectionProviderWrapperas theConnectionProviderfor thisSagaStoreimplementation- Returns:
- the current Builder instance, for fluent interfacing
-
sqlSchema
Sets theSagaSqlSchemadefining the SQL operations to execute for thisSagaStoreimplementation. Defaults to aGenericSagaSqlSchema.- Parameters:
sqlSchema- theSagaSqlSchemadefining the SQL operations to execute for thisSagaStoreimplementation- Returns:
- the current Builder instance, for fluent interfacing
-
serializer
Sets theSerializerused to de-/serialize a Saga instance.- Parameters:
serializer- aSerializerused to de-/serialize a Saga instance- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aJdbcSagaStoreas specified through this Builder.- Returns:
- a
JdbcSagaStoreas specified through this Builder
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-