A
- a representation of an action command that is shared across all actions in the saga. This is typically a generic type, such as Json, or if using Avro serialization, SpecificRecord or GenericRecordpublic static final class SagaDSL.SagaBuilder<A> extends Object
Constructor and Description |
---|
SagaBuilder() |
Modifier and Type | Method and Description |
---|---|
SagaDSL.SubSaga<A> |
addAction(ActionId actionId,
String actionType,
A actionCommand)
Adds an action with no undo action command, creating a sub saga with a single action.
|
SagaDSL.SubSaga<A> |
addAction(ActionId actionId,
String actionType,
A actionCommand,
A undoActionCommand)
Adds an action with an undo action command, creating a sub saga with a single action.
|
SagaDSL.SubSaga<A> |
addAction(String actionType,
A actionCommand)
Adds an action with a random Id and no undo action command, creating a sub saga with a single action.
|
SagaDSL.SubSaga<A> |
addAction(String actionType,
A actionCommand,
A undoActionCommand)
Adds an action with a random Id and an undo action command, creating a sub saga with a single action.
|
io.simplesource.data.Result<SagaError,Saga<A>> |
build()
builds the Saga from all the subsagas that were previously defined by creating single actions with
addAction and by defining the dependencies between these actions. |
public SagaDSL.SubSaga<A> addAction(String actionType, A actionCommand)
actionType
- the action typeactionCommand
- the action commandpublic SagaDSL.SubSaga<A> addAction(String actionType, A actionCommand, A undoActionCommand)
actionType
- the action typeactionCommand
- the action commandundoActionCommand
- the undo action commandpublic SagaDSL.SubSaga<A> addAction(ActionId actionId, String actionType, A actionCommand)
actionId
- the action idactionType
- the action typeactionCommand
- the action commandpublic SagaDSL.SubSaga<A> addAction(ActionId actionId, String actionType, A actionCommand, A undoActionCommand)
actionId
- the action idactionType
- the action typeactionCommand
- the action commandundoActionCommand
- the undo action commandpublic io.simplesource.data.Result<SagaError,Saga<A>> build()
addAction
and by defining the dependencies between these actions.
The Saga
returned can be considered an immutable data structure. Any mutations to saga state from this point on will result in a new instance being created.
Copyright © 2019. All rights reserved.