K - the aggregate keyC - all commands for this aggregateE - all events generated for this aggregateA - the aggregate@FunctionalInterface public interface CommandHandler<K,C,E,A>
| Modifier and Type | Method and Description |
|---|---|
static <K,C,E,A> CommandHandler<K,C,E,A> |
ifSeq(CommandHandler<K,C,E,A> commandHandler)
This method will wrap a
CommandHandler in a check to ensure that the current aggregate sequence
matches the expected aggregate sequence. |
Result<CommandAPI.CommandError,NonEmptyList<E>> |
interpretCommand(K key,
Sequence expectedSeq,
Sequence currentSeq,
A currentAggregate,
C command)
Determine if you will accept or reject the given command given the current aggregate aggregate and
transform into events.
|
Result<CommandAPI.CommandError,NonEmptyList<E>> interpretCommand(K key, Sequence expectedSeq, Sequence currentSeq, A currentAggregate, C command)
key - the aggregate key the command applies toexpectedSeq - the sequence we expect the current aggregate to be atcurrentSeq - the actual seq number of the current aggregatecurrentAggregate - the aggregate for this aggregate guaranteed to be up to date with all events seen to datecommand - the command to validate and convert into eventsResult providing one or more Reasons for the
rejection. If accepting return one or more events that represent the command.static <K,C,E,A> CommandHandler<K,C,E,A> ifSeq(CommandHandler<K,C,E,A> commandHandler)
CommandHandler in a check to ensure that the current aggregate sequence
matches the expected aggregate sequence. This is effectively an optimistic lock on the Aggregate.K - the aggregate keyC - all commands for this aggregateE - all events generated for this aggregateA - the aggregatecommandHandler - the command handler that will be invoked if the sequence numbers matchResult providing one or more Reasons for the
rejection. If accepting return one or more events that represent the command.Copyright © 2018. All rights reserved.