Class EventSourcedEntity


  • public class EventSourcedEntity
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <Command,​Event,​State>
      EventSourcedBehavior<Command,​Event,​State>
      apply​(EntityTypeKey<Command> entityTypeKey, java.lang.String entityId, State emptyState, scala.Function2<State,​Command,​Effect<Event,​State>> commandHandler, scala.Function2<State,​Event,​State> eventHandler)
      Create a Behavior for a persistent actor that is used with Cluster Sharding.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EventSourcedEntity

        public EventSourcedEntity()
    • Method Detail

      • apply

        public static <Command,​Event,​State> EventSourcedBehavior<Command,​Event,​State> apply​(EntityTypeKey<Command> entityTypeKey,
                                                                                                                    java.lang.String entityId,
                                                                                                                    State emptyState,
                                                                                                                    scala.Function2<State,​Command,​Effect<Event,​State>> commandHandler,
                                                                                                                    scala.Function2<State,​Event,​State> eventHandler)
        Create a Behavior for a persistent actor that is used with Cluster Sharding.

        Any Behavior can be used as a sharded entity actor, but the combination of sharding and persistent actors is very common and therefore this PersistentEntity is provided as convenience.

        It is a EventSourcedBehavior and is implemented in the same way. It selects the persistenceId automatically from the EntityTypeKey and entityId constructor parameters by using EntityTypeKey.persistenceIdFrom.

        Parameters:
        entityTypeKey - (undocumented)
        entityId - (undocumented)
        emptyState - (undocumented)
        commandHandler - (undocumented)
        eventHandler - (undocumented)
        Returns:
        (undocumented)