Interface EventSourcedEntityHandler


  • public interface EventSourcedEntityHandler
    Low level interface for handling events and commands on an entity.

    Generally, this should not be needed, instead, a class annotated with the EventHandler, CommandHandler and similar annotations should be used.

    • 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.