Class EventSourcedEntityEffectsRunner<S>


  • public abstract class EventSourcedEntityEffectsRunner<S>
    extends java.lang.Object
    Extended by generated code, not meant for user extension
    • Constructor Summary

      Constructors 
      Constructor Description
      EventSourcedEntityEffectsRunner​(com.akkaserverless.javasdk.eventsourcedentity.EventSourcedEntity<S> entity)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.Object> getAllEvents()  
      S getState()  
      protected abstract S handleEvent​(S state, java.lang.Object event)  
      protected <R> EventSourcedResult<R> interpretEffects​(java.util.function.Supplier<com.akkaserverless.javasdk.eventsourcedentity.EventSourcedEntity.Effect<R>> effect)
      creates a command context to run the commands, then creates an event context to run the events, and finally, creates a command context to run the side effects.
      • Methods inherited from class java.lang.Object

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

      • EventSourcedEntityEffectsRunner

        public EventSourcedEntityEffectsRunner​(com.akkaserverless.javasdk.eventsourcedentity.EventSourcedEntity<S> entity)
    • Method Detail

      • handleEvent

        protected abstract S handleEvent​(S state,
                                         java.lang.Object event)
        Returns:
        The current state of the entity after applying the event
      • getState

        public S getState()
        Returns:
        The current state of the entity
      • getAllEvents

        public java.util.List<java.lang.Object> getAllEvents()
        Returns:
        All events emitted by command handlers of this entity up to now
      • interpretEffects

        protected <R> EventSourcedResult<R> interpretEffects​(java.util.function.Supplier<com.akkaserverless.javasdk.eventsourcedentity.EventSourcedEntity.Effect<R>> effect)
        creates a command context to run the commands, then creates an event context to run the events, and finally, creates a command context to run the side effects. It cleans each context after each run.
        Returns:
        the result of the side effects