Class PostgresSagaSqlSchema
java.lang.Object
org.axonframework.modelling.saga.repository.jdbc.GenericSagaSqlSchema
org.axonframework.modelling.saga.repository.jdbc.PostgresSagaSqlSchema
- All Implemented Interfaces:
SagaSqlSchema
SQL schema supporting PostgreSQL databases.
This implementation uses the appropriate PostgreSQL data types (serial, bytea).
- Since:
- 2.4
- Author:
- Jochen Munz
-
Field Summary
Fields inherited from class org.axonframework.modelling.saga.repository.jdbc.GenericSagaSqlSchema
sagaSchema -
Constructor Summary
ConstructorsConstructorDescriptionInitialize a PostgresSagaSqlSchema using the default schema configuration.PostgresSagaSqlSchema(SagaSchema sagaSchema) Initialize a PostgresSagaSqlSchema using the givensagaSchema. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetExclusiveLoad(boolean exclusiveLoad) Sets whether loading of Sagas should occur exclusively by a single node, by requiring a row lock from the database.Creates a PreparedStatement that creates the table for storing Association Values for Sagas.Creates a PreparedStatement that creates the table for storing Sagas.sql_loadSaga(Connection connection, String sagaId) Creates a PreparedStatement that loads a single Saga, with givensagaId.Methods inherited from class org.axonframework.modelling.saga.repository.jdbc.GenericSagaSqlSchema
readAssociationValues, readSerializedSaga, readToken, sagaSchema, sql_deleteAssociationEntries, sql_deleteSagaEntry, sql_findAssociations, sql_findAssocSagaIdentifiers, sql_removeAssocValue, sql_storeAssocValue, sql_storeSaga, sql_updateSaga
-
Constructor Details
-
PostgresSagaSqlSchema
public PostgresSagaSqlSchema()Initialize a PostgresSagaSqlSchema using the default schema configuration. -
PostgresSagaSqlSchema
Initialize a PostgresSagaSqlSchema using the givensagaSchema.- Parameters:
sagaSchema- the saga schema configuration
-
-
Method Details
-
sql_createTableAssocValueEntry
Description copied from interface:SagaSqlSchemaCreates a PreparedStatement that creates the table for storing Association Values for Sagas.- Specified by:
sql_createTableAssocValueEntryin interfaceSagaSqlSchema- Overrides:
sql_createTableAssocValueEntryin classGenericSagaSqlSchema- Parameters:
conn- The connection to create the PreparedStatement for- Returns:
- a Prepared statement that created the Association Value table, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_createTableSagaEntry
Description copied from interface:SagaSqlSchemaCreates a PreparedStatement that creates the table for storing Sagas.- Specified by:
sql_createTableSagaEntryin interfaceSagaSqlSchema- Overrides:
sql_createTableSagaEntryin classGenericSagaSqlSchema- Parameters:
conn- The connection to create the PreparedStatement for- Returns:
- a Prepared statement that created the Saga table, when executed
- Throws:
SQLException- when an error occurs creating the PreparedStatement
-
sql_loadSaga
Description copied from interface:SagaSqlSchemaCreates a PreparedStatement that loads a single Saga, with givensagaId.- Specified by:
sql_loadSagain interfaceSagaSqlSchema- Overrides:
sql_loadSagain classGenericSagaSqlSchema- Parameters:
connection- The connection to create the PreparedStatement forsagaId- The identifier of the Saga to return- Returns:
- a statement, that creates a result set to be processed by
SagaSqlSchema.readSerializedSaga(java.sql.ResultSet), when executed - Throws:
SQLException- when an error occurs creating the PreparedStatement
-
setExclusiveLoad
public void setExclusiveLoad(boolean exclusiveLoad) Sets whether loading of Sagas should occur exclusively by a single node, by requiring a row lock from the database.If
true, only one instance of the application may load a saga at a time. This may be used to serialize event handling in sagas in multi-node configurations where noStreamingEventProcessoris used. The given processor type caveat is explained through the fact that aStreamingEventProcessorrequires claimed segments to be able to perform any event handling work. Furthermore, this segments originate from a shared resources in a distributed environment.As such, a Saga cannot be accessed concurrently through the
StreamingEventProcessor. And hence, settingexclusiveLoadtotruewould not change the underlying behavior at all.
-