Syntax
public abstract class ReceiveActor : UntypedActor, IInternalActor, IInitializableActor

Constructors Edit this page View Source

ReceiveActor()

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
Description

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
Description

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
Description

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
Description Func < object , bool > handler

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

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
Description

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
Description

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
Description

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
Description

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
Description

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
Description

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
Description

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
Description

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
Description handler

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

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
Description