A
- common representation form for all action commands (typically Json / GenericRecord for Avro)D
- intermediate decoded input type (that can easily be converted to both K and C)K
- aggregate key typeC
- simple sourcing command typepublic final class EventSourcingSpec<A,D,K,C> extends Object
CommandSpec
Modifier and Type | Class and Description |
---|---|
static interface |
EventSourcingSpec.UndoFunction<A,K,C>
The UndoFunction functional interface.
|
Modifier and Type | Field and Description |
---|---|
String |
actionType
The Action type.
|
String |
aggregateName
The Simple Sourcing aggregate name.
|
java.util.function.Function<D,C> |
commandMapper
The Command mapper maps the decoded input type to a Simple Sourcing command.
|
io.simplesource.kafka.api.CommandSerdes<K,C> |
commandSerdes
The Command serdes are required for the command request and response topics.
|
java.util.function.Function<A,io.simplesource.data.Result<Throwable,D>> |
inputDecoder
The Input decoder.
|
java.util.function.Function<D,K> |
keyMapper
The Key mapper maps the decoded input type to the aggregate key.
|
java.util.function.Function<D,io.simplesource.data.Sequence> |
sequenceMapper
The Sequence mapper maps the decoded input type to the last read aggregate sequence.
|
java.time.Duration |
timeout
The Timeout.
|
EventSourcingSpec.UndoFunction<A,K,C> |
undoCommand
The Undo command.
|
Constructor and Description |
---|
EventSourcingSpec() |
public final String actionType
public final String aggregateName
public final java.util.function.Function<A,io.simplesource.data.Result<Throwable,D>> inputDecoder
A
type is common across all action processors and action types. This enables working with a type that
is specific to this action processor.public final java.util.function.Function<D,C> commandMapper
public final java.util.function.Function<D,K> keyMapper
public final java.util.function.Function<D,io.simplesource.data.Sequence> sequenceMapper
With Simple Sourcing, updates to aggregates are versioned with a sequence number. With sequence checking enabled, the client specifies the last read sequence number. When Simple Sourcing processes the command request, it verifies that the sequence number of the aggregate is the same as the one specified by the client. This ensures that the command is being applied to the latest version of the aggregate.
With sagas, there may be more than one operation on a given aggregate instance. The client must specify the correct sequence number for the action that is executed first. After that the saga coordinator keeps track of the sequence number of the most recent write to the aggregate instance within the saga. This enables an optimistic lock to be held for the duration of the saga.
public final EventSourcingSpec.UndoFunction<A,K,C> undoCommand
async action undos
an undo command for a Simple Sourcing action must be of the same action type .public final io.simplesource.kafka.api.CommandSerdes<K,C> commandSerdes
public final java.time.Duration timeout
Copyright © 2019. All rights reserved.