Class LegacyJdbcSagaStoreAutoConfiguration
JdbcSagaStore when a DataSource is available, ported
from Axon Framework 4's JDBC saga store wiring onto axon-legacy's JdbcSagaStore builder.
Provides two bean methods, matching Axon Framework 4's bean names verbatim:
sagaStoreNoSchema(ConnectionProvider, GeneralConverter), using aGenericSagaSqlSchema, when noSagaSqlSchemabean is declared;sagaStoreWithSchema(ConnectionProvider, GeneralConverter, SagaSqlSchema), using a user-declaredSagaSqlSchema, so applications targeting a database dialect other than the generic one (see theSagaSqlSchemaimplementations for specific databases) can plug it in as a bean.
Runs after org.axonframework.extension.springboot.autoconfig.JdbcAutoConfiguration, so the
ConnectionProvider bean it provides is available, and after LegacyJpaSagaStoreAutoConfiguration,
so a JPA-backed store, when applicable, takes precedence over this JDBC-backed one -- both
ConditionalOnMissingBean checks target SagaStore, so whichever autoconfiguration runs first wins
when an application has both an EntityManagerFactory and a DataSource. The ordering reference to
JdbcAutoConfiguration uses AutoConfiguration.afterName() rather than
AutoConfiguration.after() so that axon-legacy carries no compile-time dependency on the
axon-spring-boot-autoconfigure module.
- Since:
- 5.4.0
- Author:
- Mateusz Nowak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsagaStoreNoSchema(ConnectionProvider connectionProvider, GeneralConverter converter) Provides aJdbcSagaStoreusing aGenericSagaSqlSchema, for use when noSagaStoreand noSagaSqlSchemabean are already present.sagaStoreWithSchema(ConnectionProvider connectionProvider, GeneralConverter converter, SagaSqlSchema sagaSqlSchema) Provides aJdbcSagaStoreusing the givensagaSqlSchema, for use when aSagaSqlSchemabean is present and noSagaStorebean is already present.
-
Constructor Details
-
LegacyJdbcSagaStoreAutoConfiguration
public LegacyJdbcSagaStoreAutoConfiguration()
-
-
Method Details
-
sagaStoreNoSchema
@Bean @ConditionalOnMissingBean({SagaStore.class,SagaSqlSchema.class}) public JdbcSagaStore sagaStoreNoSchema(ConnectionProvider connectionProvider, GeneralConverter converter) Provides aJdbcSagaStoreusing aGenericSagaSqlSchema, for use when noSagaStoreand noSagaSqlSchemabean are already present.- Parameters:
connectionProvider- the provider of theConnectionused to access the underlying databaseconverter- the converter used to convert a saga instance to and from its serialized form- Returns:
- a JDBC-backed
SagaStoreusing the generic SQL schema
-
sagaStoreWithSchema
@Bean @ConditionalOnMissingBean(SagaStore.class) @ConditionalOnBean(SagaSqlSchema.class) public JdbcSagaStore sagaStoreWithSchema(ConnectionProvider connectionProvider, GeneralConverter converter, SagaSqlSchema sagaSqlSchema) Provides aJdbcSagaStoreusing the givensagaSqlSchema, for use when aSagaSqlSchemabean is present and noSagaStorebean is already present.- Parameters:
connectionProvider- the provider of theConnectionused to access the underlying databaseconverter- the converter used to convert a saga instance to and from its serialized formsagaSqlSchema- the user-declared SQL schema to use- Returns:
- a JDBC-backed
SagaStoreusing the given SQL schema
-