Search Results for

    Show / Hide Table of Contents

    Class ActorSystem

    An actor system is a hierarchical group of actors which share common configuration, e.g. dispatchers, deployments, remote capabilities and addresses. It is also the entry point for creating or looking up actors. There are several possibilities for creating actors (see Props for details on props):

    system.ActorOf(props, "name");
    system.ActorOf(props);
    system.ActorOf(Props.Create(typeof(MyActor)), "name");
    system.ActorOf(Props.Create(() => new MyActor(arg1, arg2), "name");

    Where no name is given explicitly, one will be automatically generated. Important Notice: This class is not meant to be extended by user code.

    Inheritance
    object
    ActorSystem
    ExtendedActorSystem
    Implements
    IActorRefFactory
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Actor
    Assembly: Akka.dll
    Syntax
    public abstract class ActorSystem : IActorRefFactory, IDisposable

    Properties

    | Edit this page View Source

    DeadLetters

    Gets the dead letters.

    Declaration
    public abstract IActorRef DeadLetters { get; }
    Property Value
    Type Description
    IActorRef

    The dead letters.

    | Edit this page View Source

    Dispatchers

    Gets the dispatchers.

    Declaration
    public abstract Dispatchers Dispatchers { get; }
    Property Value
    Type Description
    Dispatchers

    The dispatchers.

    | Edit this page View Source

    EventStream

    Gets the event stream.

    Declaration
    public abstract EventStream EventStream { get; }
    Property Value
    Type Description
    EventStream

    The event stream.

    | Edit this page View Source

    IgnoreRef

    Declaration
    public abstract IActorRef IgnoreRef { get; }
    Property Value
    Type Description
    IActorRef
    | Edit this page View Source

    Log

    Gets the log

    Declaration
    public abstract ILoggingAdapter Log { get; }
    Property Value
    Type Description
    ILoggingAdapter
    | Edit this page View Source

    Mailboxes

    Gets the mailboxes.

    Declaration
    public abstract Mailboxes Mailboxes { get; }
    Property Value
    Type Description
    Mailboxes

    The mailboxes.

    | Edit this page View Source

    Name

    Gets the name of this system.

    Declaration
    public abstract string Name { get; }
    Property Value
    Type Description
    string

    The name.

    | Edit this page View Source

    Scheduler

    Gets the scheduler.

    Declaration
    public abstract IScheduler Scheduler { get; }
    Property Value
    Type Description
    IScheduler

    The scheduler.

    | Edit this page View Source

    Serialization

    Gets the serialization.

    Declaration
    public abstract Serialization Serialization { get; }
    Property Value
    Type Description
    Serialization

    The serialization.

    | Edit this page View Source

    Settings

    Gets the settings.

    Declaration
    public abstract Settings Settings { get; }
    Property Value
    Type Description
    Settings

    The settings.

    | Edit this page View Source

    StartTime

    Start-up time since the epoch.

    Declaration
    public TimeSpan StartTime { get; }
    Property Value
    Type Description
    TimeSpan
    | Edit this page View Source

    Uptime

    Up-time of this actor system.

    Declaration
    public TimeSpan Uptime { get; }
    Property Value
    Type Description
    TimeSpan
    | Edit this page View Source

    WhenTerminated

    Returns a task which will be completed after the ActorSystem has been terminated and termination hooks have been executed. Be careful to not schedule any operations on the dispatcher of this actor system as it will have been shut down before this task completes.

    Declaration
    public abstract Task WhenTerminated { get; }
    Property Value
    Type Description
    Task

    Methods

    | Edit this page View Source

    ActorOf(Props, string)

    Interface IActorRefFactory

    Declaration
    public abstract IActorRef ActorOf(Props props, string name = null)
    Parameters
    Type Name Description
    Props props
    string name
    Returns
    Type Description
    IActorRef
    | Edit this page View Source

    ActorSelection(ActorPath)

    Interface IActorRefFactory

    Declaration
    public abstract ActorSelection ActorSelection(ActorPath actorPath)
    Parameters
    Type Name Description
    ActorPath actorPath
    Returns
    Type Description
    ActorSelection
    | Edit this page View Source

    ActorSelection(string)

    Interface IActorRefFactory

    Declaration
    public abstract ActorSelection ActorSelection(string actorPath)
    Parameters
    Type Name Description
    string actorPath
    Returns
    Type Description
    ActorSelection
    | Edit this page View Source

    Create(string)

    Creates a new ActorSystem with the specified name.

    Declaration
    public static ActorSystem Create(string name)
    Parameters
    Type Name Description
    string name

    The name of the actor system to create. The name must be uri friendly. Must contain only word characters (i.e. [a-zA-Z0-9] plus non-leading '-'

    Returns
    Type Description
    ActorSystem

    A newly created actor system with the given name.

    | Edit this page View Source

    Create(string, BootstrapSetup)

    Shortcut for creating a new actor system with the specified name and settings.

    Declaration
    public static ActorSystem Create(string name, BootstrapSetup setup)
    Parameters
    Type Name Description
    string name

    The name of the actor system to create. The name must be uri friendly. Must contain only word characters (i.e. [a-zA-Z0-9] plus non-leading '-'

    BootstrapSetup setup

    The bootstrap setup used to help programmatically initialize the ActorSystem.

    Returns
    Type Description
    ActorSystem

    A newly created actor system with the given name and configuration.

    | Edit this page View Source

    Create(string, ActorSystemSetup)

    Shortcut for creating a new actor system with the specified name and settings.

    Declaration
    public static ActorSystem Create(string name, ActorSystemSetup setup)
    Parameters
    Type Name Description
    string name

    The name of the actor system to create. The name must be uri friendly. Must contain only word characters (i.e. [a-zA-Z0-9] plus non-leading '-'

    ActorSystemSetup setup

    The bootstrap setup used to help programmatically initialize the ActorSystem.

    Returns
    Type Description
    ActorSystem

    A newly created actor system with the given name and configuration.

    | Edit this page View Source

    Create(string, Config)

    Creates a new ActorSystem with the specified name and configuration.

    Declaration
    public static ActorSystem Create(string name, Config config)
    Parameters
    Type Name Description
    string name

    The name of the actor system to create. The name must be uri friendly. Must contain only word characters (i.e. [a-zA-Z0-9] plus non-leading '-'

    Config config

    The configuration used to create the actor system

    Returns
    Type Description
    ActorSystem

    A newly created actor system with the given name and configuration.

    | Edit this page View Source

    Dispose()

    Declaration
    public void Dispose()
    | Edit this page View Source

    GetExtension(IExtensionId)

    Retrieves the specified extension that is registered to this actor system.

    Declaration
    public abstract object GetExtension(IExtensionId extensionId)
    Parameters
    Type Name Description
    IExtensionId extensionId

    The extension to retrieve

    Returns
    Type Description
    object

    The specified extension registered to this actor system

    | Edit this page View Source

    GetExtension<T>()

    Retrieves an extension with the specified type that is registered to this actor system.

    Declaration
    public abstract T GetExtension<T>() where T : class, IExtension
    Returns
    Type Description
    T

    The specified extension registered to this actor system

    Type Parameters
    Name Description
    T

    The type of extension to retrieve

    | Edit this page View Source

    HasExtension(Type)

    Determines whether this actor system has an extension with the specified type.

    Declaration
    public abstract bool HasExtension(Type type)
    Parameters
    Type Name Description
    Type type

    The type of the extension being queried

    Returns
    Type Description
    bool

    true if this actor system has the extension; otherwise false.

    | Edit this page View Source

    HasExtension<T>()

    Determines whether this actor system has the specified extension.

    Declaration
    public abstract bool HasExtension<T>() where T : class, IExtension
    Returns
    Type Description
    bool

    true if this actor system has the extension; otherwise false.

    Type Parameters
    Name Description
    T

    The type of the extension being queried

    | Edit this page View Source

    RegisterExtension(IExtensionId)

    Registers the specified extension with this actor system.

    Declaration
    public abstract object RegisterExtension(IExtensionId extension)
    Parameters
    Type Name Description
    IExtensionId extension

    The extension to register with this actor system

    Returns
    Type Description
    object

    The extension registered with this actor system

    | Edit this page View Source

    RegisterOnTermination(Action)

    Registers a block of code (callback) to run after ActorSystem.shutdown has been issued and all actors in this actor system have been stopped. Multiple code blocks may be registered by calling this method multiple times.

    The callbacks will be run sequentially in reverse order of registration, i.e. last registration is run first.

    Declaration
    public abstract void RegisterOnTermination(Action code)
    Parameters
    Type Name Description
    Action code

    The code to run

    Exceptions
    Type Condition
    Exception

    This exception is thrown if the system has already shut down or if shutdown has been initiated.

    | Edit this page View Source

    Stop(IActorRef)

    Stops the specified actor permanently.

    Declaration
    public abstract void Stop(IActorRef actor)
    Parameters
    Type Name Description
    IActorRef actor

    The actor to stop

    Remarks

    This method has no effect if the actor is already stopped.

    | Edit this page View Source

    Terminate()

    If `akka.coordinated-shutdown.run-by-actor-system-terminate` is configured to `off` it will not run `CoordinatedShutdown`, but the `ActorSystem` and its actors will still be terminated.

    Terminates this actor system. This will stop the guardian actor, which in turn will recursively stop all its child actors, then the system guardian (below which the logging actors reside) and the execute all registered termination handlers (RegisterOnTermination(Action)).

    Be careful to not schedule any operations on completion of the returned task using the `dispatcher` of this actor system as it will have been shut down before the task completes.

    Declaration
    public abstract Task Terminate()
    Returns
    Type Description
    Task

    A Task that will complete once the actor system has finished terminating and all actors are stopped.

    | Edit this page View Source

    TryGetExtension(Type, out object)

    Tries to retrieve an extension with the specified type.

    Declaration
    public abstract bool TryGetExtension(Type extensionType, out object extension)
    Parameters
    Type Name Description
    Type extensionType

    The type of extension to retrieve

    object extension

    The extension that is retrieved if successful

    Returns
    Type Description
    bool

    true if the retrieval was successful; otherwise false.

    | Edit this page View Source

    TryGetExtension<T>(out T)

    Tries to retrieve an extension with the specified type

    Declaration
    public abstract bool TryGetExtension<T>(out T extension) where T : class, IExtension
    Parameters
    Type Name Description
    T extension

    The extension that is retrieved if successful

    Returns
    Type Description
    bool

    true if the retrieval was successful; otherwise false.

    Type Parameters
    Name Description
    T

    The type of extension to retrieve

    Implements

    IActorRefFactory
    IDisposable

    Extension Methods

    ActorSystemWithExtensions.WithExtension<T>(ActorSystem)
    ActorSystemWithExtensions.WithExtension<T>(ActorSystem, Type)
    ActorSystemWithExtensions.WithExtension<T, TI>(ActorSystem)
    DistributedDataExtensions.DistributedData(ActorSystem)
    TcpExtensions.Tcp(ActorSystem)
    UdpExtensions.Udp(ActorSystem)
    PersistenceQueryExtensions.ReadJournalFor<TJournal>(ActorSystem, string)
    TcpStreamExtensions.TcpStream(ActorSystem)
    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    ActorRefFactoryExtensions.ActorOf<TActor>(IActorRefFactory, string)
    ActorRefFactoryExtensions.ActorSelection(IActorRefFactory, IActorRef, string)
    ActExtensions.ActorOf(IActorRefFactory, Action<IActorDsl, IActorContext>, string)
    ActExtensions.ActorOf(IActorRefFactory, Action<IActorDsl>, string)
    ActorMaterializerExtensions.Materializer(IActorRefFactory, ActorMaterializerSettings, string)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET