SagaStore.Entry<T>
Constructor and Description |
---|
JdbcSagaStore(ConnectionProvider connectionProvider)
Initializes a Saga Repository, using given
connectionProvider to obtain connections to the
database, using a Generic SQL Schema. |
JdbcSagaStore(ConnectionProvider connectionProvider,
SagaSqlSchema sqldef)
Initializes a Saga Repository, using given
connectionProvider to obtain connections to the
database, and given sqldef to execute SQL statements. |
JdbcSagaStore(ConnectionProvider connectionProvider,
SagaSqlSchema sqldef,
Serializer serializer)
Initializes a Saga Repository, using given
connectionProvider to obtain connections to the
database, and given sqldef to execute SQL statements and serializer to serialize
Sagas. |
JdbcSagaStore(DataSource dataSource,
SagaSqlSchema sqldef)
Initializes a Saga Repository, using given
dataSource to obtain connections to the database, and
given sqldef to execute SQL statements. |
Modifier and Type | Method and Description |
---|---|
void |
createSchema()
Creates the SQL Schema required to store Sagas and their associations,.
|
void |
deleteSaga(Class<?> sagaType,
String sagaIdentifier,
Set<AssociationValue> associationValues)
Deletes a Saga with given
sagaType and sagaIdentifier and all its associations. |
Set<String> |
findSagas(Class<?> sagaType,
AssociationValue associationValue)
Returns identifiers of saga instances of the given
sagaType that have been associated with the given
associationValue . |
void |
insertSaga(Class<?> sagaType,
String sagaIdentifier,
Object saga,
TrackingToken token,
Set<AssociationValue> associationValues)
Adds a new Saga and its initial association values to the store.
|
<S> SagaStore.Entry<S> |
loadSaga(Class<S> sagaType,
String sagaIdentifier)
|
void |
setSerializer(Serializer serializer)
Sets the Serializer instance to serialize Sagas with.
|
void |
updateSaga(Class<?> sagaType,
String sagaIdentifier,
Object saga,
TrackingToken token,
AssociationValues associationValues)
Updates a given Saga after its state was modified.
|
public JdbcSagaStore(ConnectionProvider connectionProvider)
connectionProvider
to obtain connections to the
database, using a Generic SQL Schema.connectionProvider
- The data source to obtain connections frompublic JdbcSagaStore(DataSource dataSource, SagaSqlSchema sqldef)
dataSource
to obtain connections to the database, and
given sqldef
to execute SQL statements.dataSource
- The data source to obtain connections fromsqldef
- The definition of SQL operations to executepublic JdbcSagaStore(ConnectionProvider connectionProvider, SagaSqlSchema sqldef)
connectionProvider
to obtain connections to the
database, and given sqldef
to execute SQL statements.connectionProvider
- The provider to obtain connections fromsqldef
- The definition of SQL operations to executepublic JdbcSagaStore(ConnectionProvider connectionProvider, SagaSqlSchema sqldef, Serializer serializer)
connectionProvider
to obtain connections to the
database, and given sqldef
to execute SQL statements and serializer
to serialize
Sagas.connectionProvider
- The provider to obtain connections fromsqldef
- The definition of SQL operations to executeserializer
- The serializer to serialize and deserialize Saga instances withpublic <S> SagaStore.Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier)
SagaStore
SagaStore.Entry
instance with given sagaType
and unique sagaIdentifier
.
Due to the concurrent nature of Sagas, it is not unlikely for a Saga to have ceased to exist after it has been
found based on associations. Therefore, a repository should return null
in case a Saga doesn't
exists, as opposed to throwing an exception.
public Set<String> findSagas(Class<?> sagaType, AssociationValue associationValue)
SagaStore
sagaType
that have been associated with the given
associationValue
.public void deleteSaga(Class<?> sagaType, String sagaIdentifier, Set<AssociationValue> associationValues)
SagaStore
sagaType
and sagaIdentifier
and all its associations. For convenience
all known association values are passed along as well, which has the advantage that the saga store is not
required to keep an index of association value to saga identifier.deleteSaga
in interface SagaStore<Object>
sagaType
- The type of saga to deletesagaIdentifier
- The identifier of the saga to deleteassociationValues
- The known associations of the sagapublic void updateSaga(Class<?> sagaType, String sagaIdentifier, Object saga, TrackingToken token, AssociationValues associationValues)
SagaStore
token
may be null
if the Saga is not tracking the
event store.updateSaga
in interface SagaStore<Object>
sagaType
- The type of the SagasagaIdentifier
- The identifier of the Sagasaga
- The Saga instancetoken
- The tracking token of the event last handled by the Saga. May be null
.associationValues
- The initial association values of the Sagapublic void insertSaga(Class<?> sagaType, String sagaIdentifier, Object saga, TrackingToken token, Set<AssociationValue> associationValues)
SagaStore
token
may be null
if the Saga is not tracking the event store.insertSaga
in interface SagaStore<Object>
sagaType
- The type of the SagasagaIdentifier
- The identifier of the Sagasaga
- The Saga instancetoken
- The tracking token of the event last handled by the Saga. May be null
.associationValues
- The initial association values of the Sagapublic void setSerializer(Serializer serializer)
serializer
- the Serializer instance to serialize Sagas withpublic void createSchema() throws SQLException
SQLException
- When an error occurs preparing of executing the required statementsCopyright © 2010–2018. All rights reserved.