Interface EventSourcedEntityHandler
-
public interface EventSourcedEntityHandlerLow level interface for handling events and commands on an entity.Generally, this should not be needed, instead, a class annotated with the
EventHandler,CommandHandlerand similar annotations should be used.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<com.google.protobuf.Any>handleCommand(com.google.protobuf.Any command, CommandContext context)Handle the given command.voidhandleEvent(com.google.protobuf.Any event, EventContext context)Handle the given event.voidhandleSnapshot(com.google.protobuf.Any snapshot, SnapshotContext context)Handle the given snapshot.java.util.Optional<com.google.protobuf.Any>snapshot(SnapshotContext context)Snapshot the object.
-
-
-
Method Detail
-
handleEvent
void handleEvent(com.google.protobuf.Any event, EventContext context)Handle the given event.- Parameters:
event- The event to handle.context- The event context.
-
handleCommand
java.util.Optional<com.google.protobuf.Any> handleCommand(com.google.protobuf.Any command, CommandContext context)Handle the given command.- Parameters:
command- The command to handle.context- The command context.- Returns:
- The reply to the command, if the command isn't being forwarded elsewhere.
-
handleSnapshot
void handleSnapshot(com.google.protobuf.Any snapshot, SnapshotContext context)Handle the given snapshot.- Parameters:
snapshot- The snapshot to handle.context- The snapshot context.
-
snapshot
java.util.Optional<com.google.protobuf.Any> snapshot(SnapshotContext context)
Snapshot the object.- Returns:
- The current snapshot, if this object supports snapshoting, otherwise empty.
-
-