public abstract class AbstractFlowExecutionRepository extends Object implements FlowExecutionRepository, FlowExecutionKeyFactory
FlowExecutionStateRestorer
, used to
rehydrate a flow execution after it has been obtained from storage from resume.
The configured FlowExecutionStateRestorer
should be compatible with the chosen FlowExecution
implementation and its FlowExecutionFactory
.
Modifier and Type | Method and Description |
---|---|
boolean |
getAlwaysGenerateNewNextKey()
The flag indicating if a new
FlowExecutionKey should always be generated before each put call. |
ConversationManager |
getConversationManager()
The conversation service to delegate to for managing conversations initiated by this repository.
|
abstract FlowExecution |
getFlowExecution(FlowExecutionKey key)
Return the
FlowExecution indexed by the provided key. |
FlowExecutionKey |
getKey(FlowExecution execution)
Get the key to assign to the flow execution.
|
FlowExecutionLock |
getLock(FlowExecutionKey key)
Return the lock for the flow execution, allowing for the lock to be acquired or released.
|
FlowExecutionKey |
parseFlowExecutionKey(String encodedKey)
Parse the string-encoded flow execution key into its object form.
|
abstract void |
putFlowExecution(FlowExecution flowExecution)
Place the
FlowExecution in this repository under the provided key. |
void |
removeFlowExecution(FlowExecution flowExecution)
Remove the flow execution from the repository.
|
void |
setAlwaysGenerateNewNextKey(boolean alwaysGenerateNewNextKey)
Sets the flag indicating if a new
FlowExecutionKey should always be generated before each put call. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
removeAllFlowExecutionSnapshots, removeFlowExecutionSnapshot, updateFlowExecutionSnapshot
public ConversationManager getConversationManager()
public boolean getAlwaysGenerateNewNextKey()
FlowExecutionKey
should always be generated before each put call.public void setAlwaysGenerateNewNextKey(boolean alwaysGenerateNewNextKey)
FlowExecutionKey
should always be generated before each put call. By
setting this to false a FlowExecution can remain identified by the same key throughout its life.public FlowExecutionKey getKey(FlowExecution execution)
FlowExecutionKeyFactory
getKey
in interface FlowExecutionKeyFactory
execution
- the flow executionpublic FlowExecutionKey parseFlowExecutionKey(String encodedKey) throws FlowExecutionRepositoryException
FlowExecutionRepository
FlowExecutionKey.toString()
.parseFlowExecutionKey
in interface FlowExecutionRepository
encodedKey
- the string encoded keyFlowExecutionRepositoryException
public FlowExecutionLock getLock(FlowExecutionKey key) throws FlowExecutionRepositoryException
FlowExecutionRepository
FlowExecutionLock lock = repository.getLock(key); lock.lock(); try { FlowExecution execution = repository.getFlowExecution(key); // do work } finally { lock.unlock(); }
getLock
in interface FlowExecutionRepository
key
- the identifier of the flow execution to lockFlowExecutionRepositoryException
- a problem occurred accessing the lock objectpublic void removeFlowExecution(FlowExecution flowExecution) throws FlowExecutionRepositoryException
FlowExecutionRepository
removeFlowExecution
in interface FlowExecutionRepository
flowExecution
- the flow executionFlowExecutionRepositoryException
- the flow execution could not be removed.public abstract FlowExecution getFlowExecution(FlowExecutionKey key) throws FlowExecutionRepositoryException
FlowExecutionRepository
FlowExecution
indexed by the provided key. The returned flow execution represents the
restored state of an executing flow from a point in time. This should be called to resume a persistent flow
execution. Before calling this method, you should acquire the lock for the keyed flow execution.getFlowExecution
in interface FlowExecutionRepository
key
- the flow execution keyFlowExecutionRepositoryException
- if no flow execution was indexed with the key providedpublic abstract void putFlowExecution(FlowExecution flowExecution) throws FlowExecutionRepositoryException
FlowExecutionRepository
FlowExecution
in this repository under the provided key. This should be called to save
or update the persistent state of an active (but paused) flow execution. Before calling this method, you should
acquire the lock for the keyed flow execution.putFlowExecution
in interface FlowExecutionRepository
flowExecution
- the flow executionFlowExecutionRepositoryException
- the flow execution could not be stored