Class ReplicatedEventSourcedOnCommandWithReplyBehavior<Command,​Event,​State>


  • public abstract class ReplicatedEventSourcedOnCommandWithReplyBehavior<Command,​Event,​State>
    extends EventSourcedOnCommandWithReplyBehavior<Command,​Event,​State>
    Base class for replicated event sourced behaviors for projects built with Java 17 or newer where message handling can be done using switch pattern match.

    Enforces replies to every received command.

    For building replicated event sourced actors with Java versions before 17, see ReplicatedEventSourcedBehavior

    • Constructor Detail

      • ReplicatedEventSourcedOnCommandWithReplyBehavior

        public ReplicatedEventSourcedOnCommandWithReplyBehavior​(ReplicationContext replicationContext,
                                                                java.util.Optional<BackoffSupervisorStrategy> onPersistFailure)
      • ReplicatedEventSourcedOnCommandWithReplyBehavior

        public ReplicatedEventSourcedOnCommandWithReplyBehavior​(ReplicationContext replicationContext)
    • Method Detail

      • replicationInterceptor

        public java.util.Optional<ReplicationInterceptor<Event,​State>> replicationInterceptor()
        If a callback is returned it is invoked when an event from another replica arrives, delaying persisting the event until the returned completion stage completes, if the future fails the actor is crashed.

        Only used when the entity is replicated.

      • withEventPublishing

        public boolean withEventPublishing()
        Override and return false to disable events being published to the system event stream as PublishedEvent after they have been persisted.