Interface IActorContext
TBD
Inherited Members
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public interface IActorContext : IActorRefFactory, ICanWatch
Properties
| Edit this page View SourceDispatcher
The dispatcher this actor is running on
Declaration
MessageDispatcher Dispatcher { get; }
Property Value
| Type | Description |
|---|---|
| MessageDispatcher |
Parent
Gets the IActorRef of the parent of the current actor.
Declaration
IActorRef Parent { get; }
Property Value
| Type | Description |
|---|---|
| IActorRef |
Props
Declaration
Props Props { get; }
Property Value
| Type | Description |
|---|---|
| Props |
ReceiveTimeout
Gets the inactivity deadline timeout set using SetReceiveTimeout(TimeSpan?).
Declaration
TimeSpan? ReceiveTimeout { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan? |
Self
Gets the IActorRef belonging to the current actor.
Declaration
IActorRef Self { get; }
Property Value
| Type | Description |
|---|---|
| IActorRef |
Sender
Gets the IActorRef of the actor who sent the current message.
If the message was not sent by an actor (i.e. some external non-actor code sent this actor a message) then this value will default to NoSender.
Declaration
IActorRef Sender { get; }
Property Value
| Type | Description |
|---|---|
| IActorRef |
System
Gets a reference to the ActorSystem to which this actor belongs.
Declaration
ActorSystem System { get; }
Property Value
| Type | Description |
|---|---|
| ActorSystem |
Methods
| Edit this page View SourceBecome(Receive)
Changes the actor's behavior and replaces the current receive handler with the specified handler.
Declaration
void Become(Receive receive)
Parameters
| Type | Name | Description |
|---|---|---|
| Receive | receive | The new message handler. |
BecomeStacked(Receive)
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
void BecomeStacked(Receive receive)
Parameters
| Type | Name | Description |
|---|---|---|
| Receive | receive | The new message handler. |
Child(string)
Retrieves a child actor with the specified name, if it exists.
If the child with the given name cannot be found, then Nobody will be returned instead.
Declaration
IActorRef Child(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the child actor. e.g. "child1", "foo" Not the path, just the name of the child at the time it was created by this parent. |
Returns
| Type | Description |
|---|---|
| IActorRef | The IActorRef belonging to the child if found, Nobody otherwise. |
GetChildren()
Gets all of the children that belong to this actor.
If this actor has no children, an empty collection of IActorRef is returned instead.
Declaration
IEnumerable<IActorRef> GetChildren()
Returns
| Type | Description |
|---|---|
| IEnumerable<IActorRef> | TBD |
SetReceiveTimeout(TimeSpan?)
Defines the inactivity timeout after which the sending of a ReceiveTimeout message is triggered. When specified, the receive function should be able to handle a ReceiveTimeout message.
Please note that the receive timeout might fire and enqueue the ReceiveTimeout message right after another message was enqueued; hence it is not guaranteed that upon reception of the receive timeout there must have been an idle period beforehand as configured via this method.
Once set, the receive timeout stays in effect (i.e. continues firing repeatedly after inactivity
periods). Pass in null to switch off this feature.
Declaration
void SetReceiveTimeout(TimeSpan? timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan? | timeout | The timeout. Pass in |
Stop(IActorRef)
Issues a stop command to the provided IActorRef, which will cause that actor to terminate.
Declaration
void Stop(IActorRef child)
Parameters
| Type | Name | Description |
|---|---|---|
| IActorRef | child | The actor who will be stopped. |
UnbecomeStacked()
Changes the actor's behavior and replaces the current receive handler with the previous one on the behavior stack.
Declaration
void UnbecomeStacked()
Edit this page