Search Results for

    Show / Hide Table of Contents

    Class ReceiveActor

    TBD

    Inheritance
    object
    ActorBase
    UntypedActor
    ReceiveActor
    Act
    DistributedPubSubMediator
    ClusterSingletonProxy
    LmdbDurableStore
    EchoActor
    ForwardActor
    SimpleEchoActor
    UnhandledMessageActor
    TestOutputLogger
    TestOutputLogger
    Implements
    IInternalActor
    IInitializableActor
    Inherited Members
    UntypedActor.Receive(object)
    UntypedActor.RunTask(Action)
    UntypedActor.RunTask(Func<Task>)
    UntypedActor.Become(UntypedReceive)
    UntypedActor.BecomeStacked(UntypedReceive)
    UntypedActor.Context
    ActorBase.Sender
    ActorBase.Self
    ActorBase.AroundReceive(Receive, object)
    ActorBase.EmptyReceive
    ActorBase.Unhandled(object)
    ActorBase.Become(Receive)
    ActorBase.BecomeStacked(Receive)
    ActorBase.UnbecomeStacked()
    ActorBase.SetReceiveTimeout(TimeSpan?)
    ActorBase.AroundPreRestart(Exception, object)
    ActorBase.AroundPreStart()
    ActorBase.PreStart()
    ActorBase.AroundPostRestart(Exception, object)
    ActorBase.PreRestart(Exception, object)
    ActorBase.PostRestart(Exception)
    ActorBase.AroundPostStop()
    ActorBase.PostStop()
    ActorBase.SupervisorStrategy()
    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 ReceiveActor : UntypedActor, IInternalActor, IInitializableActor

    Constructors

    | Edit this page View Source

    ReceiveActor()

    TBD

    Declaration
    protected ReceiveActor()

    Methods

    | Edit this page View Source

    Become(Action)

    Changes the actor's behavior and replaces the current receive handler with the specified handler.

    Declaration
    protected void Become(Action configure)
    Parameters
    Type Name Description
    Action configure

    Configures the new handler by calling the different Receive overloads.

    | Edit this page View Source

    BecomeStacked(Action)

    Changes the actor's behavior and replaces the current receive handler with the specified handler. The current handler is stored on a stack, and you can revert to it by calling UnbecomeStacked() Please note, that in order to not leak memory, make sure every call to BecomeStacked(Action) is matched with a call to UnbecomeStacked().

    Declaration
    protected void BecomeStacked(Action configure)
    Parameters
    Type Name Description
    Action configure

    Configures the new handler by calling the different Receive overloads.

    | Edit this page View Source

    OnReceive(object)

    TBD

    Declaration
    protected override sealed void OnReceive(object message)
    Parameters
    Type Name Description
    object message

    TBD

    Overrides
    UntypedActor.OnReceive(object)
    | Edit this page View Source

    Receive(Type, Action<object>, Predicate<object>)

    Registers a handler for incoming messages of the specified messageType. If shouldHandle!=null then it must return true before a message is passed to handler. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void Receive(Type messageType, Action<object> handler, Predicate<object> shouldHandle = null)
    Parameters
    Type Name Description
    Type messageType

    The type of the message

    Action<object> handler

    The message handler that is invoked for incoming messages of the specified messageType

    Predicate<object> shouldHandle

    When not null it is used to determine if the message matches.

    Exceptions
    Type Condition
    InvalidOperationException

    This exception is thrown if this method is called outside of the actor's constructor or from Become(Action).

    | Edit this page View Source

    Receive(Type, Func<object, bool>)

    Registers a handler for incoming messages of the specified messageType. The handler should return true if it has handled the message. If the handler returns true no more handlers will be tried; otherwise the next registered handler will be tried. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void Receive(Type messageType, Func<object, bool> handler)
    Parameters
    Type Name Description
    Type messageType

    The type of the message

    Func<object, bool> handler

    The message handler that is invoked for incoming messages of the specified type messageType. It should return trueif it handled/matched the message; false otherwise.

    Exceptions
    Type Condition
    InvalidOperationException

    This exception is thrown if this method is called outside of the actor's constructor or from Become(Action).

    | Edit this page View Source

    Receive(Type, Predicate<object>, Action<object>)

    Registers a handler for incoming messages of the specified messageType. If shouldHandle!=null then it must return true before a message is passed to handler. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void Receive(Type messageType, Predicate<object> shouldHandle, Action<object> handler)
    Parameters
    Type Name Description
    Type messageType

    The type of the message

    Predicate<object> shouldHandle

    When not null it is used to determine if the message matches.

    Action<object> handler

    The message handler that is invoked for incoming messages of the specified messageType

    Exceptions
    Type Condition
    InvalidOperationException

    This exception is thrown if this method is called outside of the actor's constructor or from Become(Action).

    | Edit this page View Source

    ReceiveAny(Action<object>)

    Registers a handler for incoming messages of any type. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void ReceiveAny(Action<object> handler)
    Parameters
    Type Name Description
    Action<object> handler

    The message handler that is invoked for all

    Exceptions
    Type Condition
    InvalidOperationException

    This exception is thrown if this method is called outside of the actor's constructor or from Become(Action).

    | Edit this page View Source

    ReceiveAnyAsync(Func<object, Task>)

    Registers an asynchronous handler for incoming messages of any type. The actor will be suspended until the task returned by handler completes. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void ReceiveAnyAsync(Func<object, Task> handler)
    Parameters
    Type Name Description
    Func<object, Task> handler

    The message handler that is invoked for all

    | Edit this page View Source

    ReceiveAsync(Type, Func<object, Task>, Predicate<object>)

    Registers an asynchronous handler for incoming messages of the specified messageType. If shouldHandle!=null then it must return true before a message is passed to handler. The actor will be suspended until the task returned by handler completes. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void ReceiveAsync(Type messageType, Func<object, Task> handler, Predicate<object> shouldHandle = null)
    Parameters
    Type Name Description
    Type messageType

    The type of the message

    Func<object, Task> handler

    The message handler that is invoked for incoming messages of the specified messageType

    Predicate<object> shouldHandle

    When not null it is used to determine if the message matches.

    | Edit this page View Source

    ReceiveAsync(Type, Predicate<object>, Func<object, Task>)

    Registers an asynchronous handler for incoming messages of the specified messageType. If shouldHandle!=null then it must return true before a message is passed to handler. The actor will be suspended until the task returned by handler completes. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void ReceiveAsync(Type messageType, Predicate<object> shouldHandle, Func<object, Task> handler)
    Parameters
    Type Name Description
    Type messageType

    The type of the message

    Predicate<object> shouldHandle

    When not null it is used to determine if the message matches.

    Func<object, Task> handler

    The message handler that is invoked for incoming messages of the specified messageType

    | Edit this page View Source

    ReceiveAsync<T>(Func<T, Task>, Predicate<T>)

    Registers an asynchronous handler for incoming messages of the specified type T. If shouldHandle!=null then it must return true before a message is passed to handler. The actor will be suspended until the task returned by handler completes. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void ReceiveAsync<T>(Func<T, Task> handler, Predicate<T> shouldHandle = null)
    Parameters
    Type Name Description
    Func<T, Task> handler

    The message handler that is invoked for incoming messages of the specified type T

    Predicate<T> shouldHandle

    When not null it is used to determine if the message matches.

    Type Parameters
    Name Description
    T

    The type of the message

    | Edit this page View Source

    ReceiveAsync<T>(Predicate<T>, Func<T, Task>)

    Registers an asynchronous handler for incoming messages of the specified type T. If shouldHandle!=null then it must return true before a message is passed to handler. The actor will be suspended until the task returned by handler completes. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void ReceiveAsync<T>(Predicate<T> shouldHandle, Func<T, Task> handler)
    Parameters
    Type Name Description
    Predicate<T> shouldHandle

    When not null it is used to determine if the message matches.

    Func<T, Task> handler

    The message handler that is invoked for incoming messages of the specified type T

    Type Parameters
    Name Description
    T

    The type of the message

    | Edit this page View Source

    Receive<T>(Action<T>, Predicate<T>)

    Registers a handler for incoming messages of the specified type T. If shouldHandle!=null then it must return true before a message is passed to handler. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void Receive<T>(Action<T> handler, Predicate<T> shouldHandle = null)
    Parameters
    Type Name Description
    Action<T> handler

    The message handler that is invoked for incoming messages of the specified type T

    Predicate<T> shouldHandle

    When not null it is used to determine if the message matches.

    Type Parameters
    Name Description
    T

    The type of the message

    Exceptions
    Type Condition
    InvalidOperationException

    This exception is thrown if this method is called outside of the actor's constructor or from Become(Action).

    | Edit this page View Source

    Receive<T>(Func<T, bool>)

    Registers a handler for incoming messages of the specified type T. The handler should return true if it has handled the message. If the handler returns true no more handlers will be tried; otherwise the next registered handler will be tried. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void Receive<T>(Func<T, bool> handler)
    Parameters
    Type Name Description
    Func<T, bool> handler

    The message handler that is invoked for incoming messages of the specified type T. It should return trueif it handled/matched the message; false otherwise.

    Type Parameters
    Name Description
    T

    The type of the message

    Exceptions
    Type Condition
    InvalidOperationException

    This exception is thrown if this method is called outside of the actor's constructor or from Become(Action).

    | Edit this page View Source

    Receive<T>(Predicate<T>, Action<T>)

    Registers a handler for incoming messages of the specified type T. If shouldHandle!=null then it must return true before a message is passed to handler. This method may only be called when constructing the actor or from Become(Action) or BecomeStacked(Action). Note that handlers registered prior to this may have handled the message already. In that case, this handler will not be invoked.

    Declaration
    protected void Receive<T>(Predicate<T> shouldHandle, Action<T> handler)
    Parameters
    Type Name Description
    Predicate<T> shouldHandle

    When not null it is used to determine if the message matches.

    Action<T> handler

    The message handler that is invoked for incoming messages of the specified type T

    Type Parameters
    Name Description
    T

    The type of the message

    Exceptions
    Type Condition
    InvalidOperationException

    This exception is thrown if this method is called outside of the actor's constructor or from Become(Action).

    Implements

    IInternalActor
    IInitializableActor

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    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