Interface Handler<COMMAND,EVENT,ERROR,STATE>
-
- Type Parameters:
COMMAND- The type of Commands that thehandle(Object, Object)can processEVENT- The type of Events that can be returned byhandle(Object, Object)and applied in theStateEvolver.applyEvent(Object, Object)ERROR- The type of Error that can be returned by thehandle(Object, Object)methodSTATE- The type of Aggregate State that thisDeciderworks with inhandle(Object, Object),InitialStateProvider.initialState(),StateEvolver.applyEvent(Object, Object)andIsStateFinalResolver.isFinal(Object)
- All Known Subinterfaces:
Decider<COMMAND,EVENT,ERROR,STATE>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Handler<COMMAND,EVENT,ERROR,STATE>
Deciderrelated interface that is responsible for handlingCOMMAND(s),whose side effect is either anERRORor a List ofEVENT's (can be an empty list)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HandlerResult<ERROR,EVENT>handle(COMMAND cmd, STATE state)Theexecutemethod is responsible for handling aCOMMAND, which can either result in anERRORor a list ofEVENT's (can be an empty list).
Note: This method is calleddecidein the decider pattern
Idempotent handling of aCOMMANDwill result in an empty list ofEVENT's
-
-
-
Method Detail
-
handle
HandlerResult<ERROR,EVENT> handle(COMMAND cmd, STATE state)
Theexecutemethod is responsible for handling aCOMMAND, which can either result in anERRORor a list ofEVENT's (can be an empty list).
Note: This method is calleddecidein the decider pattern
Idempotent handling of aCOMMANDwill result in an empty list ofEVENT's- Parameters:
cmd- the command to handlestate- the state of the aggregate- Returns:
- either an
ERRORor a list ofEVENT's.
Idempotent handling of aCOMMANDwill result in an empty list ofEVENT's
-
-