Class ReceiveActor
TBD
Inheritance
Inherited Members
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public abstract class ReceiveActor : UntypedActor, IInternalActor, IInitializableActor
Constructors
| Edit this page View SourceReceiveActor()
TBD
Declaration
protected ReceiveActor()
Methods
| Edit this page View SourceBecome(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. |
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()
Declaration
protected void BecomeStacked(Action configure)
Parameters
Type | Name | Description |
---|---|---|
Action | configure | Configures the new handler by calling the different Receive overloads. |
OnReceive(object)
TBD
Declaration
protected override sealed void OnReceive(object message)
Parameters
Type | Name | Description |
---|---|---|
object | message | TBD |
Overrides
| Edit this page View SourceReceive(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
.
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 |
Predicate<object> | shouldHandle | When not |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception is thrown if this method is called outside of the actor's constructor or from Become(Action). |
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.
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 |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception is thrown if this method is called outside of the actor's constructor or from Become(Action). |
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
.
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 |
Action<object> | handler | The message handler that is invoked for incoming messages of the specified |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception is thrown if this method is called outside of the actor's constructor or from Become(Action). |
ReceiveAny(Action<object>)
Registers a handler for incoming messages of any type.
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). |
ReceiveAnyAsync(Func<object, Task>)
Registers an asynchronous handler for incoming messages of any type.
handler
completes.
Declaration
protected void ReceiveAnyAsync(Func<object, Task> handler)
Parameters
Type | Name | Description |
---|---|---|
Func<object, Task> | handler | The message handler that is invoked for all |
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
.
handler
completes.
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 |
Predicate<object> | shouldHandle | When not |
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
.
handler
completes.
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 |
Func<object, Task> | handler | The message handler that is invoked for incoming messages of the specified |
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
.
handler
completes.
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 |
Predicate<T> | shouldHandle | When not |
Type Parameters
Name | Description |
---|---|
T | The type of the message |
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
.
handler
completes.
Declaration
protected void ReceiveAsync<T>(Predicate<T> shouldHandle, Func<T, Task> handler)
Parameters
Type | Name | Description |
---|---|---|
Predicate<T> | shouldHandle | When not |
Func<T, Task> | handler | The message handler that is invoked for incoming messages of the specified type |
Type Parameters
Name | Description |
---|---|
T | The type of the message |
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
.
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 |
Predicate<T> | shouldHandle | When not |
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). |
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.
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 |
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). |
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
.
Declaration
protected void Receive<T>(Predicate<T> shouldHandle, Action<T> handler)
Parameters
Type | Name | Description |
---|---|---|
Predicate<T> | shouldHandle | When not |
Action<T> | handler | The message handler that is invoked for incoming messages of the specified type |
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). |