Package org.apache.pekko.actor
package org.apache.pekko.actor
-
ClassDescriptionJava API: compatible with lambda expressionsThe actor context - the view of the actor cell from the actor.Defines which messages the Actor can handle, along with the implementation of how the messages should be processed.Java API: compatible with lambda expressionsJava API: compatible with lambda expressionsJava API: Support for scheduled
self
messages viaTimerScheduler
.Java API: compatible with lambda expressionsJava API: compatible with lambda expressionsAbstractExtensionId<T extends Extension>Java API for ExtensionIdAbstractFSM<S,D> Java API: compatible with lambda expressionsJava API: compatible with lambda expressionsAbstractFSMWithStash<S,D> Java API: compatible with lambda expressionsJava API: compatible with lambda expressionsAbstractLoggingFSM<S,D> Java API: compatible with lambda expressionsJava API: Factory for Props instances.An Apache Pekko scheduler service.Actor base trait that should be extended by or mixed to create an Actor with the semantics of the 'Actor Model': https://en.wikipedia.org/wiki/Actor_modelemptyBehavior is a Receive-expression that matches no messages at all, ever.ignoringBehavior is a Receive-expression that consumes and ignores all messages.Everything in here is completely Pekko PRIVATE.The actor context - the view of the actor cell from the actor.Reply topekko.actor.Identify
.An ActorInitializationException is thrown when the initialization logic for an Actor fails.When an InterruptedException is thrown inside an Actor, it is wrapped as an ActorInterruptedException as to avoid cascading interrupts to other threads than the originally interrupted one.ActorKilledException is thrown when an Actor receives thepekko.actor.Kill
messageScala API: Mix in ActorLogging into your Actor to easily obtain a reference to a logger, which is available under the name "log".This is public with the purpose to document the used markers and properties of log events.This is public with the purpose to document the used markers and properties of log events.WhenActorSelection.resolveOne(org.apache.pekko.util.Timeout)
can't identify the actor theFuture
is completed with this failure.Actor path is a unique path to an actor that shows the creation path up through the actor tree to the root actor.Given an ActorPath it returns the Address and the path elements if the path is well-formedGiven an ActorPath it returns the Address and the path elements if the path is well-formedJava APIJava APIImmutable and serializable handle to an actor, which may or may not reside on the local host or inside the samepekko.actor.ActorSystem
.Interface implemented by ActorSystem and ActorContext, the only two places from which you can get fresh actors.Interface for all ActorRef providers to implement.All ActorRefs have a scope which describes where they live.An ActorSelection is a logical view of a section of an ActorSystem's tree of Actors, allowing for broadcasting of messages to that section.An ActorSelection is a logical view of a section of an ActorSystem's tree of Actors, allowing for broadcasting of messages to that section.An actor system is a hierarchical group of actors which share common configuration, e.g.Settings are the overall ActorSystem Settings which also provides a convenient access to the Config object.INTERNAL APIThe address specifies the physical location under which an Actor can be reached.This object serves as extractor for Scala and as address parser for Java.This object serves as extractor for Scala and as address parser for Java.Subscribe to this class to be notified about allDeadLetter
(also the suppressed ones) andDropped
.Applies the fault handlingDirective
(Resume, Restart, Stop) specified in theDecider
to all children when one fails, as opposed topekko.actor.OneForOneStrategy
that applies it only to the child actor that failed.INTERNAL APISignifies something that can be cancelled There is no strict guarantee that the implementation is thread-safe, but it should be good practice to make it so.INTERNAL APIINTERNAL APIINTERNAL APIChildRestartStats is the statistics kept by every parent Actor for every child Actor and is used for SupervisorStrategies to know how to deal with problems that occur for the children.INTERNAL APIGlue API introduced to allow minimal user effort integration between classic and typed for example for streams.Glue API introduced to allow minimal user effort integration between classic and typed for example for streams.Reason for the shutdown, which can be used by tasks in case they need to do different things depending on what caused the shutdown.INTERNAL APIWhen a message is sent to an Actor that is terminated before receiving the message, it will be sent as a DeadLetter to the ActorSystem's EventStream.Use with caution: Messages extending this trait will not be logged by the default dead-letters listener.A DeathPactException is thrown by an Actor that receives a Terminated(someActor) message that it doesn't handle itself, effectively crashing the Actor and escalating to the supervisor.Scala API: Mix in DiagnosticActorLogging into your Actor to easily obtain a reference to a logger with MDC support, which is available under the name "log".Envelope that is published on the eventStream wrapped inpekko.actor.DeadLetter
for every message that is dropped due to overfull queues or routers with no routees.The DynamicAccess implementation is the class which is used for loading all configurable parts of an actor system (thepekko.actor.ReflectiveDynamicAccess
is the default implementation).More powerful interface to the actor system’s implementation which is presented to extensions (seepekko.actor.Extension
).The basic ActorSystem covers all that is needed for locally running actors, using futures and so on.ExtensionId<T extends Extension>Identifies an Extension Lookup of Extensions is done by object identity, so the Id must be the same wherever it's used, otherwise you'll get the same extension loaded multiple times.To be able to load an ExtensionId from the configuration, a class that implements ExtensionIdProvider must be specified.FSM<S,D> Finite State Machine actor trait.This extractor is just convenience for matching a (S, S) pair, including a reminder what the new state is.Message type which is sent directly to the subscribed actor inpekko.actor.FSM.SubscribeTransitionCallBack
before sending anypekko.actor.FSM.Transition
messages.FSM.Event<D>All messages sent to thepekko.actor.FSM
will be wrapped inside anEvent
, which allows pattern matching to extract both state and data.Signifies that thepekko.actor.FSM
is shutting itself down because of an error, e.g.INTERNAL APIINTERNAL APIFSM.LogEntry<S,D> Log Entry of thepekko.actor.LoggingFSM
, can be obtained by callinggetLog
.Default reason if callingstop()
.A partial function value which does not match anything and can be used to “reset”whenUnhandled
andonTermination
handlers.Reason why thispekko.actor.FSM
is shutting down.Reason given when someone was callingsystem.stop(fsm)
from outside; also applies toStop
supervision directive.FSM.SilentState<S,D> INTERNAL API Using a subclass for binary compatibility reasonsINTERNAL APIFSM.State<S,D> This captures all of the managed state of thepekko.actor.FSM
: the state name, the state data, possibly custom timeout, stop reason and replies accumulated while processing the last message.This case object is received in case of a state timeout.FSM.StopEvent<S,D> Case class representing the state of thepekko.actor.FSM
within theonTermination
block.Send this to anpekko.actor.FSM
to request first theFSM.CurrentState
and then a series ofFSM.Transition
updates.INTERNAL APIINTERNAL APIMessage type which is used to communicate transitions between states to all subscribed listeners (usepekko.actor.FSM.SubscribeTransitionCallBack
).Unsubscribe frompekko.actor.FSM.Transition
notifications which was effected by sending the correspondingpekko.actor.FSM.SubscribeTransitionCallBack
.INTERNAL APIA message all Actors will understand, that when processed will reply withpekko.actor.ActorIdentity
containing theActorRef
.INTERNAL APIIllegalActorStateException is thrown when a core invariant in the Actor implementation has been violated.This interface defines a class of actor creation strategies deviating from the usual default of just reflectively instantiating theActor
subclass.INTERNAL APIAn InvalidActorNameException is thrown when you try to convert something, usually a String, to an Actor name which doesn't validate.InvalidMessageException is thrown when an invalid message is sent to an Actor; Currently onlynull
is an invalid message.A message all Actors will understand, that when processed will make the Actor throw an ActorKilledException, which will trigger supervision.This scheduler implementation is based on a revolving wheel of buckets, like Netty’s HashedWheelTimer, which it advances at a fixed tick rate and dispatches tasks it finds in the current bucket to their respective ExecutionContexts.INTERNAL APIINTERNAL APIRefs which are statically known to be local inherit from this ScopeThe Local Scope is the default one, which is assumed on all deployments which do not set a different scope.LoggingFSM<S,D> Stackable trait forpekko.actor.FSM
which adds a rolling event log and debug logging capabilities (analogous topekko.event.LoggingReceive
).Trait for ActorRef implementations where all methods contain default stubs.This is an internal look-up failure token, not useful for anything else.This is an internal look-up failure token, not useful for anything else.This is the default value and as such allows overrides.Marker trait to signal that this class should not be verified for serializability.Marker trait to indicate that a message should not reset the receive timeout.Applies the fault handlingDirective
(Resume, Restart, Stop) specified in theDecider
to the child actor that failed, as opposed topekko.actor.AllForOneStrategy
that applies it to all children.This is an extractor for retrieving the original cause (i.e.This is an extractor for retrieving the original cause (i.e.A message all Actors will understand, that when processed will terminate the Actor permanently.Marker trait to indicate that a message might be potentially harmful, this is used to block messages coming in over remoting.A PostRestartException is thrown when constructor or postRestart() method fails during a restart attempt.A PreRestartException is thrown when the preRestart() method failed; this exception is not propagated to the supervisor, as it originates from the already failed instance, hence it is only visible as log entry on the event stream.Factory for Props instances.When using ActorContext.setReceiveTimeout, the singleton instance of ReceiveTimeout will be sent to the Actor when there hasn't been any message for that long.This is the defaultpekko.actor.DynamicAccess
implementation used bypekko.actor.ExtendedActorSystem
unless overridden.Extractor for so-called “relative actor paths” as in “relative URI”, not in “relative to some actor”.Extractor for so-called “relative actor paths” as in “relative URI”, not in “relative to some actor”.RepointableActorRef (and potentially others) may change their locality at runtime, meaning that isLocal might not be stable.Root of the hierarchy of ActorPaths.Contains the Scala API (!-method) for ActorSelections) which provides automatic tracking of the sender, as per the usual implicit ActorRef pattern.An Apache Pekko scheduler service.INTERNAL APIIf aTaskRunOnClose
is used inscheduleOnce
it will be run when theScheduler
is closed (ActorSystem
shutdown).This exception is thrown by Scheduler.schedule* when scheduling is not possible, e.g.A Task that will be notified when it is cancelled.The scope of apekko.actor.Deploy
serves two purposes: as a marker for pattern matching the “scope” (i.e.INTERNAL APIINTERNAL APIINTERNAL APIINTERNAL APIINTERNAL APIINTERNAL APITheStash
trait enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior.INTERNAL API.Is thrown when the size of the Stash exceeds the capacity of the StashSuperseeded bypekko.pattern.StatusReply
, prefer that when possible.This class/message type is preferably used to indicate failure of some operation performed.This class/message type is preferably used to indicate success of some operation performed.Superseeded bypekko.pattern.StatusReply
, prefer that when possible.A Pekko SupervisorStrategy is the policy to apply for crashing children.Escalates the failure to the supervisor of the supervisor, by rethrowing the cause of the failure, i.e.Discards the old Actor instance and replaces it with a new, then resumes message processing.Resumes message processing for the failed ActorStops the ActorImplement this interface in order to configure the supervisorStrategy for the top-level guardian actor (/user
).Similar toDeadLetter
with the slight twist of NOT being logged by the default dead letters listener.INTERNAL APIFor the purpose of orderly shutdown it's possible to register interest in the termination of systemGuardian and receive a notificationTerminationHook
before systemGuardian is stopped.INTERNAL APIWhen Death Watch is used, the watcher will receive a Terminated(watched) message when watched is terminated.Scala API: Mix in Timers into your Actor to get support for scheduledself
messages viaTimerScheduler
.Support for scheduledself
messages in an actor.INTERNAL APITheUnboundedStash
trait is a version ofpekko.actor.Stash
that enforces an unbounded stash for you actor.This message is published to the EventStream whenever an Actor receives a message it doesn't understandA version ofpekko.actor.Stash
that does not enforce any mailbox type.If the validation of theReceiveBuilder
match logic turns out to be a bottleneck for some of your actors you can consider to implement it at lower level by extendingUntypedAbstractActor
instead ofAbstractActor
.Java API: compatible with lambda expressionsJava API: Support for scheduledself
messages viaTimerScheduler
.Java API: compatible with lambda expressionsJava API: compatible with lambda expressionsJava API: compatible with lambda expressionsMessage envelopes may implement this trait for better logging, such as logging of message class name of the wrapped message instead of the envelope class name.