Interface Eventsourced

    • Method Detail

      • super$aroundPreStart

        void super$aroundPreStart()
      • super$aroundPreRestart

        void super$aroundPreRestart​(java.lang.Throwable reason,
                                    scala.Option<java.lang.Object> message)
        INTERNAL API.
      • super$aroundPostRestart

        void super$aroundPostRestart​(java.lang.Throwable reason)
        INTERNAL API.
      • super$aroundPostStop

        void super$aroundPostStop()
        INTERNAL API.
      • super$unhandled

        void super$unhandled​(java.lang.Object message)
      • super$stash

        void super$stash()
        Returns true if this persistent actor has successfully finished recovery.
      • super$aroundReceive

        void super$aroundReceive​(scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> receive,
                                 java.lang.Object msg)
        Processes a loaded snapshot, if any. A loaded snapshot is offered with a SnapshotOffer message to the actor's receiveRecover. Then initiates a message replay, either starting from the loaded snapshot or from scratch, and switches to recoveryStarted state. All incoming messages are stashed.

        Parameters:
        replayMax - maximum number of messages to replay.
        timeout - recovery event timeout
        receive - (undocumented)
        msg - (undocumented)
      • journalBatch_$eq

        void journalBatch_$eq​(scala.collection.immutable.Vector<PersistentEnvelope> x$1)
      • writeInProgress_$eq

        void writeInProgress_$eq​(boolean x$1)
      • sequenceNr_$eq

        void sequenceNr_$eq​(long x$1)
      • _lastSequenceNr_$eq

        void _lastSequenceNr_$eq​(long x$1)
      • pendingStashingPersistInvocations_$eq

        void pendingStashingPersistInvocations_$eq​(long x$1)
      • eventBatch_$eq

        void eventBatch_$eq​(scala.collection.immutable.List<PersistentEnvelope> x$1)
      • snapshotterId

        java.lang.String snapshotterId()
        Returns persistenceId.
        Specified by:
        snapshotterId in interface Snapshotter
        Returns:
        (undocumented)
      • lastSequenceNr

        long lastSequenceNr()
        Highest received sequence number so far or 0L if this actor hasn't replayed or stored any persistent events yet.
        Returns:
        (undocumented)
      • snapshotSequenceNr

        long snapshotSequenceNr()
        Returns lastSequenceNr.
        Specified by:
        snapshotSequenceNr in interface Snapshotter
        Returns:
        (undocumented)
      • onReplaySuccess

        void onReplaySuccess()
        INTERNAL API. Called whenever a message replay succeeds. May be implemented by subclass.
      • onRecoveryFailure

        void onRecoveryFailure​(java.lang.Throwable cause,
                               scala.Option<java.lang.Object> event)
        Called whenever a message replay fails. By default it logs the error.

        Subclass may override to customize logging.

        The actor is always stopped after this method has been invoked.

        Parameters:
        cause - failure cause.
        event - the event that was processed in receiveRecover, if the exception was thrown there
      • onPersistFailure

        void onPersistFailure​(java.lang.Throwable cause,
                              java.lang.Object event,
                              long seqNr)
        Called when persist fails. By default it logs the error. Subclass may override to customize logging and for example send negative acknowledgment to sender.

        The actor is always stopped after this method has been invoked.

        Note that the event may or may not have been saved, depending on the type of failure.

        Parameters:
        cause - failure cause.
        event - the event that was to be persisted
        seqNr - (undocumented)
      • onPersistRejected

        void onPersistRejected​(java.lang.Throwable cause,
                               java.lang.Object event,
                               long seqNr)
        Called when the journal rejected persist of an event. The event was not stored. By default this method logs the problem as an error, and the actor continues. The callback handler that was passed to the persist method will not be invoked.

        Parameters:
        cause - failure cause
        event - the event that was to be persisted
        seqNr - (undocumented)
      • stashInternally

        void stashInternally​(java.lang.Object currMsg)
      • unstashInternally

        void unstashInternally​(boolean all)
      • startRecovery

        void startRecovery​(Recovery recovery)
      • aroundReceive

        void aroundReceive​(scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> receive,
                           java.lang.Object message)
        INTERNAL API.
        Specified by:
        aroundReceive in interface Actor
        Parameters:
        receive - current behavior.
        message - current message.
      • aroundPreStart

        void aroundPreStart()
        INTERNAL API.
        Specified by:
        aroundPreStart in interface Actor
      • requestRecoveryPermit

        void requestRecoveryPermit()
      • aroundPreRestart

        void aroundPreRestart​(java.lang.Throwable reason,
                              scala.Option<java.lang.Object> message)
        INTERNAL API.
        Specified by:
        aroundPreRestart in interface Actor
        Parameters:
        reason - (undocumented)
        message - (undocumented)
      • aroundPostRestart

        void aroundPostRestart​(java.lang.Throwable reason)
        INTERNAL API.
        Specified by:
        aroundPostRestart in interface Actor
        Parameters:
        reason - (undocumented)
      • aroundPostStop

        void aroundPostStop()
        INTERNAL API.
        Specified by:
        aroundPostStop in interface Actor
      • unhandled

        void unhandled​(java.lang.Object message)
        Description copied from interface: Actor
        User overridable callback.

        Is called when a message isn't handled by the current behavior of the actor by default it fails with either a DeathPactException (in case of an unhandled Terminated message) or publishes an UnhandledMessage to the actor's system's EventStream
        Specified by:
        unhandled in interface Actor
        Parameters:
        message - (undocumented)
      • updateLastSequenceNr

        void updateLastSequenceNr​(PersistentRepr persistent)
      • setLastSequenceNr

        void setLastSequenceNr​(long value)
      • nextSequenceNr

        long nextSequenceNr()
      • flushJournalBatch

        void flushJournalBatch()
      • receiveRecover

        scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> receiveRecover()
        Recovery handler that receives persisted events during recovery. If a state snapshot has been captured and saved, this handler will receive a SnapshotOffer message followed by events that are younger than the offered snapshot.

        This handler must not have side-effects other than changing persistent actor state i.e. it should not perform actions that may fail, such as interacting with external services, for example.

        If there is a problem with recovering the state of the actor from the journal, the error will be logged and the actor will be stopped.

        Returns:
        (undocumented)
        See Also:
        Recovery
      • receiveCommand

        scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> receiveCommand()
        Command handler. Typically validates commands against current state (and/or by communication with other actors). On successful validation, one or more events are derived from a command and these events are then persisted by calling persist.
        Returns:
        (undocumented)
      • internalPersist

        <A> void internalPersist​(A event,
                                 scala.Function1<A,​scala.runtime.BoxedUnit> handler)
        Internal API
        Parameters:
        event - (undocumented)
        handler - (undocumented)
      • internalPersistAll

        <A> void internalPersistAll​(scala.collection.immutable.Seq<A> events,
                                    scala.Function1<A,​scala.runtime.BoxedUnit> handler)
        Internal API
        Parameters:
        events - (undocumented)
        handler - (undocumented)
      • internalPersistAsync

        <A> void internalPersistAsync​(A event,
                                      scala.Function1<A,​scala.runtime.BoxedUnit> handler)
        Internal API
        Parameters:
        event - (undocumented)
        handler - (undocumented)
      • internalPersistAllAsync

        <A> void internalPersistAllAsync​(scala.collection.immutable.Seq<A> events,
                                         scala.Function1<A,​scala.runtime.BoxedUnit> handler)
        Internal API
        Parameters:
        events - (undocumented)
        handler - (undocumented)
      • internalDeferAsync

        <A> void internalDeferAsync​(A event,
                                    scala.Function1<A,​scala.runtime.BoxedUnit> handler)
        Internal API
        Parameters:
        event - (undocumented)
        handler - (undocumented)
      • internalDefer

        <A> void internalDefer​(A event,
                               scala.Function1<A,​scala.runtime.BoxedUnit> handler)
        Internal API
        Parameters:
        event - (undocumented)
        handler - (undocumented)
      • deleteMessages

        void deleteMessages​(long toSequenceNr)
        Permanently deletes all persistent messages with sequence numbers less than or equal toSequenceNr.

        If the delete is successful a DeleteMessagesSuccess will be sent to the actor. If the delete fails a DeleteMessagesFailure will be sent to the actor.

        The given toSequenceNr must be less than or equal to lastSequenceNr(), otherwise DeleteMessagesFailure is sent to the actor without performing the delete. All persistent messages may be deleted without specifying the actual sequence number by using Long.MaxValue as the toSequenceNr.

        Parameters:
        toSequenceNr - upper sequence number (inclusive) bound of persistent messages to be deleted.
      • recoveryRunning

        boolean recoveryRunning()
        Returns true if this persistent actor is currently recovering.
        Returns:
        (undocumented)
      • recoveryFinished

        boolean recoveryFinished()
        Returns true if this persistent actor has successfully finished recovery.
        Returns:
        (undocumented)
      • stash

        void stash()
        Description copied from interface: StashSupport
        Adds the current message (the message that the actor received last) to the actor's stash.

        Specified by:
        stash in interface StashSupport
      • unstashAll

        void unstashAll()
        Description copied from interface: StashSupport
        Prepends all messages in the stash to the mailbox, and then clears the stash.

        Messages from the stash are enqueued to the mailbox until the capacity of the mailbox (if any) has been reached. In case a bounded mailbox overflows, a MessageQueueAppendFailedException is thrown.

        The stash is guaranteed to be empty after calling unstashAll().

        Specified by:
        unstashAll in interface StashSupport
      • waitingRecoveryPermit

        java.lang.Object waitingRecoveryPermit​(Recovery recovery)
      • recoveryStarted

        java.lang.Object recoveryStarted​(long replayMax,
                                         scala.concurrent.duration.FiniteDuration timeout)
      • recovering

        java.lang.Object recovering​(scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> recoveryBehavior,
                                    scala.concurrent.duration.FiniteDuration timeout)
      • flushBatch

        void flushBatch()
      • peekApplyHandler

        void peekApplyHandler​(java.lang.Object payload)