public abstract class LockingSagaRepository<T> extends Object implements SagaRepository<T>
Modifier and Type | Class and Description |
---|---|
static class |
LockingSagaRepository.Builder<T>
Abstract Builder class to instantiate
LockingSagaRepository implementations. |
Modifier | Constructor and Description |
---|---|
protected |
LockingSagaRepository(LockingSagaRepository.Builder<T> builder)
Instantiate a
LockingSagaRepository based on the fields contained in the LockingSagaRepository.Builder . |
Modifier and Type | Method and Description |
---|---|
Saga<T> |
createInstance(String sagaIdentifier,
Supplier<T> factoryMethod)
Creates a new Saga instance.
|
protected abstract Saga<T> |
doCreateInstance(String sagaIdentifier,
Supplier<T> factoryMethod)
Creates a new Saga instance.
|
protected abstract Saga<T> |
doLoad(String sagaIdentifier)
Loads a known Saga instance by its unique identifier.
|
Saga<T> |
load(String sagaIdentifier)
Loads a known Saga instance by its unique identifier.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
find
protected LockingSagaRepository(LockingSagaRepository.Builder<T> builder)
LockingSagaRepository
based on the fields contained in the LockingSagaRepository.Builder
.
Will assert that the LockFactory
is not null
. Will throw an AxonConfigurationException
if
it is.
builder
- the LockingSagaRepository.Builder
used to instantiate a LockingSagaRepository
instancepublic Saga<T> load(String sagaIdentifier)
null
in case a Saga doesn't
exists, as opposed to throwing an exception.
This implementation locks access to sagas with the given sagaIdentifier
and releases the lock in the
clean-up phase of the current UnitOfWork
.
load
in interface SagaRepository<T>
sagaIdentifier
- The unique identifier of the Saga to loadnull
if no such saga existspublic Saga<T> createInstance(String sagaIdentifier, Supplier<T> factoryMethod)
factoryMethod
.
This implementation locks access to sagas with the given sagaIdentifier
and releases the lock in the
clean-up phase of the current UnitOfWork
.
createInstance
in interface SagaRepository<T>
sagaIdentifier
- the identifier to use for the new saga instancefactoryMethod
- Used to create a new Saga delegateT
protected abstract Saga<T> doLoad(String sagaIdentifier)
null
in case a Saga doesn't exists, as opposed to throwing an exception.sagaIdentifier
- The unique identifier of the Saga to loadnull
if no such saga existsprotected abstract Saga<T> doCreateInstance(String sagaIdentifier, Supplier<T> factoryMethod)
factoryMethod
.sagaIdentifier
- the identifier to use for the new saga instancefactoryMethod
- Used to create a new Saga delegateT
Copyright © 2010–2023. All rights reserved.