Package

akka.persistence.multidc

javadsl

Permalink

package javadsl

Content Hierarchy
Visibility
  1. Public
  2. All

Type Members

  1. class ApiCompileTest extends AnyRef

    Permalink
  2. final class ByStateCommandHandlerBuilder[Command, Event, State] extends SignalHandlerBuilder[Command, Event, State]

    Permalink

    Mutable builder for nested Java CommandHandlers where different states should have different command handlers.

    Mutable builder for nested Java CommandHandlers where different states should have different command handlers. CommandHandler per state are added with the match methods and finally a CommandHandler is created with ByStateCommandHandlerBuilder#build.

    Match statements are appended and evaluated in order, the first one to match is used. If no match is found when evaluating the built CommandHandler for a given state a scala.MatchError is thrown.

    Instances should not be created by user code but instead accessed through ReplicatedEntity#commandHandlerBuilder.

  3. abstract class CommandHandler[Command, Event, State] extends AnyRef

    Permalink

    Not for user extension.

    Not for user extension. Instances are created through a builder, see ReplicatedEntity#commandHandlerBuilder

    Annotations
    @DoNotInherit()
  4. final class CommandHandlerBuilder[Command, Event, State] extends SignalHandlerBuilder[Command, Event, State]

    Permalink

    Mutable builder for Java CommandHandlers.

    Mutable builder for Java CommandHandlers. Handling of commands are added with the match methods and finally a CommandHandler is created with CommandHandlerBuilder#build.

    Match statements are appended and evaluated in order, the first one to match is used. If no match is found when evaluating the built CommandHandler for a given command a scala.MatchError is thrown.

    Instances should not be created by user code but instead accessed through ReplicatedEntity#commandHandlerBuilder.

  5. trait CommandToEffect[Command, Event, State] extends AnyRef

    Permalink

    SAM for reacting on commands

    SAM for reacting on commands

    Used with CommandHandlerBuilder to setup the behavior of a ReplicatedEntity

    Annotations
    @FunctionalInterface()
  6. abstract class Effect[+Event, State] extends AnyRef

    Permalink

    A command handler returns a Effect directive that defines what event or events, if any, to persist.

    A command handler returns a Effect directive that defines what event or events, if any, to persist. Use the thenPersist, thenPersistAll or done methods of the context that is passed to the command handler function to create the Effect directive.

    Additional side effects can be performed in the callback andThen

    Instances of Effect are available through factories in the respective Java and Scala DSL packages.

    Not intended for user extension.

    Annotations
    @DoNotInherit()
  7. sealed class EffectFactories[Command, Event, State] extends AnyRef

    Permalink

    Not intended for user extension.

    Not intended for user extension.

    Annotations
    @DoNotInherit()
  8. trait EventHandler[Event, State >: Null] extends AnyRef

    Permalink

    Can be created with a EventHandlerBuilder available in ReplicatedEntity#eventHandlerBuilder but can also be provided manually (as a lambda).

    Can be created with a EventHandlerBuilder available in ReplicatedEntity#eventHandlerBuilder but can also be provided manually (as a lambda).

    Annotations
    @FunctionalInterface()
  9. final class EventHandlerBuilder[Event, State >: Null] extends AnyRef

    Permalink
  10. abstract class ReplicatedEntity[Command, Event, State >: Null] extends InternalReplicatedEntity[Command, Event, State]

    Permalink

    A ReplicatedEntity has a stable entity identifier, with which it can be accessed from anywhere in the cluster.

    A ReplicatedEntity has a stable entity identifier, with which it can be accessed from anywhere in the cluster. It is run by an actor and the state is persistent using event sourcing.

    initialState, commandHandler and eventHandler are abstract methods that your concrete subclass must implement.

    The commandHandler defines how to process incoming commands, construct one using the builder returned by commandHandlerBuilder to use the same handler regardless of state or the byStateCommandHandlerBuilder to have different handling depending on state.

    Persistent and replicated events are applied to the state with the eventHandler. Construct an event handler using the builder returned by eventHandlerBuilder.

    The ReplicatedEntity receives commands of type Command that can be validated before persisting state changes as events of type Event. The functions that process incoming commands are registered in the CommandHandler using onCommand of the CommandHandler.

    A command may also be read-only and only perform some side-effect, such as replying to the request. Such command handlers are registered using onReadOnlyCommand of the CommandHandler. Replies are sent with the sender() ActorRef in the context or an ActorRef that is passed in the command.

    A command handler returns a Effect directive that defines what event or events, if any, to persist. Use the thenPersist, thenPersistAll or done methods of the context that is passed to the command handler function to create the Effect directive.

    When an event has been persisted successfully the state of type State is updated by applying the event to the current state by invoking the eventHandler. The eventHandler returns the new state. The state must be immutable, so you return a new instance of the state. Current state is passed as parameter to the event handler. The same event handlers are also used when the entity is started up to recover its state from the stored events.

    After persisting an event, external side effects can be performed with the andThen function of the Effect directive. A typical side effect is to reply to the request to confirm that it was performed successfully. Replies are sent with the sender() ActorRef in the context or an ActorRef that is passed in the command.

    The event handlers are typically only updating the state, but they may also change the behavior of the entity in the sense that new functions for processing commands and events may be defined for a given state. This is useful when implementing finite state machine (FSM) like entities.

    When the entity is started the state is recovered by replaying stored events. To reduce this recovery time the entity may start the recovery from a snapshot of the state and then only replaying the events that were stored after the snapshot. Such snapshots are automatically saved after a configured number of persisted events.

    Command

    the super type of all commands

    Event

    the super type of all events

    State

    the type of the state

    Annotations
    @ApiMayChange()
  11. trait SignalHandler[Signal, Event, State] extends AnyRef

    Permalink

    SAM for reacting on signals

    SAM for reacting on signals

    Used with CommandHandlerBuilder to setup the behavior of a ReplicatedEntity

    Annotations
    @FunctionalInterface()

Value Members

  1. object EffectFactory extends EffectFactories[Nothing, Nothing, Nothing]

    Permalink

    Singleton object for the effect factories, do not use directly, instead use ReplicatedEntity#Effect

  2. object ReplicatedEntity

    Permalink
    Annotations
    @ApiMayChange()

Ungrouped