Interface EventSourcedEntity.Effect.Builder<S,E>

Type Parameters:
S - The type of the state for this entity.
Enclosing interface:
EventSourcedEntity.Effect<T>

public static interface EventSourcedEntity.Effect.Builder<S,E>
Construct the effect that is returned by the command handler. The effect describes next processing actions, such as persisting events and sending a reply.
  • Method Details Link icon

    • persist Link icon

      Persist a single event. After this event is persisted, the event handler
      invalid reference
      #applyEvent(E event)
      is called in order to update the entity state.
    • persist Link icon

      EventSourcedEntity.Effect.OnSuccessBuilder<S> persist(E event1, E event2, E... events)
      Persist the passed events. After these events are persisted, the event handler EventSourcedEntity.applyEvent(E) is called in order to update the entity state. Note, the event handler is called only once after all events are persisted.
    • persistAll Link icon

      EventSourcedEntity.Effect.OnSuccessBuilder<S> persistAll(List<? extends E> events)
      Persist the passed List of events. After these events are persisted, the event handler EventSourcedEntity.applyEvent(E) is called in order to update the entity state. Note, the event handler is called only once after all events are persisted.
    • reply Link icon

      <T> EventSourcedEntity.ReadOnlyEffect<T> reply(T message)
      Create a message reply.
      Type Parameters:
      T - The type of the message that must be returned by this call.
      Parameters:
      message - The payload of the reply.
      Returns:
      A message reply.
    • reply Link icon

      <T> EventSourcedEntity.ReadOnlyEffect<T> reply(T message, Metadata metadata)
      Create a message reply.
      Type Parameters:
      T - The type of the message that must be returned by this call.
      Parameters:
      message - The payload of the reply.
      metadata - The metadata for the message.
      Returns:
      A message reply.
    • error Link icon

      <T> EventSourcedEntity.ReadOnlyEffect<T> error(String description)
      Create an error reply.
      Type Parameters:
      T - The type of the message that must be returned by this call.
      Parameters:
      description - The description of the error.
      Returns:
      An error reply.