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 class Saga<A> extends Object
Modifier and Type | Field and Description |
---|---|
Map<ActionId,SagaAction<A>> |
actions
Actions are stored in a map by
ActionId . |
List<SagaError> |
sagaError
If the saga fails, the cumulative list of errors that occurred in the processing for the saga.
|
SagaId |
sagaId
The Saga id uniquely identifies the saga.
|
io.simplesource.data.Sequence |
sequence
The sequence number of the saga, indicating the number of saga state transitions that have occurred.
|
SagaStatus |
status
The status of the saga.
|
Constructor and Description |
---|
Saga() |
Modifier and Type | Method and Description |
---|---|
static <A> Saga<A> |
of(Map<ActionId,SagaAction<A>> actions) |
static <A> Saga<A> |
of(SagaId sagaId,
Map<ActionId,SagaAction<A>> actions,
SagaStatus status,
io.simplesource.data.Sequence sequence)
Static constructor for a Saga.
|
Saga<A> |
updated(Map<ActionId,SagaAction<A>> actions,
SagaStatus status)
Creates a new saga instances with an updated set of actions and saga status.
|
Saga<A> |
updated(Map<ActionId,SagaAction<A>> actions,
SagaStatus status,
List<SagaError> sagaError)
Creates a new saga instances with an updated set of actions, saga status and error list.
|
Saga<A> |
updated(SagaStatus status)
Creates a new saga instances with an updated saga status.
|
Saga<A> |
updated(SagaStatus status,
List<SagaError> sagaError)
Creates a new saga instances with an updated saga status and error list.
|
public final SagaId sagaId
public final Map<ActionId,SagaAction<A>> actions
ActionId
. ActionId
uniquely identifies the action (consisting of the command definition, the undo command definition if there is one and the action state).public final SagaStatus status
public final List<SagaError> sagaError
public final io.simplesource.data.Sequence sequence
public static <A> Saga<A> of(SagaId sagaId, Map<ActionId,SagaAction<A>> actions, SagaStatus status, io.simplesource.data.Sequence sequence)
It is suggested that clients do not define a saga directly through this method, but rather use the saga client DSL to build the saga.
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 GenericRecordsagaId
- the saga id uniquely defines the sagaactions
- a map of saga actionsstatus
- the saga statussequence
- the sequence number of the sagapublic static <A> Saga<A> of(Map<ActionId,SagaAction<A>> actions)
public Saga<A> updated(SagaStatus status)
status
- the statuspublic Saga<A> updated(SagaStatus status, List<SagaError> sagaError)
status
- the statussagaError
- the saga errorpublic Saga<A> updated(Map<ActionId,SagaAction<A>> actions, SagaStatus status, List<SagaError> sagaError)
actions
- the actionsstatus
- the statussagaError
- the saga errorpublic Saga<A> updated(Map<ActionId,SagaAction<A>> actions, SagaStatus status)
actions
- the actionsstatus
- the statusCopyright © 2019. All rights reserved.