Class ActorCell
INTERNAL API.
The hosting infrastructure for actors.
Inherited Members
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public class ActorCell : IUntypedActorContext, IActorContext, IActorRefFactory, ICanWatch, ICell
Constructors
| Improve this Doc View SourceActorCell(ActorSystemImpl, IInternalActorRef, Props, MessageDispatcher, IInternalActorRef)
TBD
Declaration
public ActorCell(ActorSystemImpl system, IInternalActorRef self, Props props, MessageDispatcher dispatcher, IInternalActorRef parent)
Parameters
Type | Name | Description |
---|---|---|
ActorSystemImpl | system | TBD |
Akka.Actor.IInternalActorRef | self | TBD |
Props | props | TBD |
MessageDispatcher | dispatcher | TBD |
Akka.Actor.IInternalActorRef | parent | TBD |
Fields
| Improve this Doc View SourceUndefinedUid
Constant placeholder value for actors without a defined unique identifier.
Declaration
public const int UndefinedUid = 0
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceChildrenContainer
The child container collection, used to house information about all child actors.
Declaration
public IChildrenContainer ChildrenContainer { get; }
Property Value
Type | Description |
---|---|
IChildrenContainer |
CurrentEnvelopeId
INTERNAL API
Declaration
public int CurrentEnvelopeId { get; }
Property Value
Type | Description |
---|---|
Int32 |
CurrentMessage
The current message the actor is processing right now.
Declaration
public object CurrentMessage { get; }
Property Value
Type | Description |
---|---|
Object |
Remarks
Will be set to null
when not processing any message.
Dispatcher
This actor's message dispatcher.
Declaration
public MessageDispatcher Dispatcher { get; }
Property Value
Type | Description |
---|---|
MessageDispatcher |
HasMessages
Will return true
if NumberOfMessages is greater than zero.
Declaration
public bool HasMessages { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsLocal
Returns true
if this actor is local to the system. Can only return false
if this actor
is remotely deployed from elsewhere.
Declaration
public bool IsLocal { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsNormal
TBD
Declaration
protected bool IsNormal { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsTerminated
Indicates whether the actor is currently terminated.
Declaration
public bool IsTerminated { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsTerminating
TBD
Declaration
protected bool IsTerminating { get; }
Property Value
Type | Description |
---|---|
Boolean |
Mailbox
This actor's mailbox instance.
Declaration
public Mailbox Mailbox { get; }
Property Value
Type | Description |
---|---|
Mailbox |
NumberOfMessages
Current message count inside the mailbox.
Declaration
public int NumberOfMessages { get; }
Property Value
Type | Description |
---|---|
Int32 |
Parent
This actor's parent actor.
Declaration
public IInternalActorRef Parent { get; }
Property Value
Type | Description |
---|---|
Akka.Actor.IInternalActorRef |
Props
The Props used to create this actor.
Declaration
public Props Props { get; }
Property Value
Type | Description |
---|---|
Props |
Remarks
Will be re-used in the event that the actor restarts.
ReceiveTimeout
TBD
Declaration
public TimeSpan? ReceiveTimeout { get; }
Property Value
Type | Description |
---|---|
Nullable<TimeSpan> |
Self
The IActorRef instance that represents the current actor.
Declaration
public IActorRef Self { get; }
Property Value
Type | Description |
---|---|
IActorRef |
Sender
The actor who sent us CurrentMessage.
Declaration
public IActorRef Sender { get; }
Property Value
Type | Description |
---|---|
IActorRef |
Remarks
Will be null
when we are not processing messages.
System
The ActorSystem this actor belongs to.
Declaration
public ActorSystem System { get; }
Property Value
Type | Description |
---|---|
ActorSystem |
SystemImpl
INTERNAL API
Declaration
public ActorSystemImpl SystemImpl { get; }
Property Value
Type | Description |
---|---|
ActorSystemImpl |
TaskScheduler
Used by this actor to schedule Task instances.
Declaration
public virtual ActorTaskScheduler TaskScheduler { get; }
Property Value
Type | Description |
---|---|
ActorTaskScheduler |
Methods
| Improve this Doc View SourceActorOf(Props, String)
TBD
Declaration
public virtual IActorRef ActorOf(Props props, string name = null)
Parameters
Type | Name | Description |
---|---|---|
Props | props | TBD |
String | name | TBD |
Returns
Type | Description |
---|---|
IActorRef | A reference to the new child actor. |
Exceptions
Type | Condition |
---|---|
InvalidActorNameException | This exception is thrown if the given |
ArgumentException | This exception is thrown if a pre-creation serialization occurred. |
InvalidOperationException | This exception is thrown if the actor tries to create a child while it is terminating or is terminated. |
ActorSelection(ActorPath)
TBD
Declaration
public ActorSelection ActorSelection(ActorPath path)
Parameters
Type | Name | Description |
---|---|---|
ActorPath | path | TBD |
Returns
Type | Description |
---|---|
ActorSelection | TBD |
ActorSelection(String)
TBD
Declaration
public ActorSelection ActorSelection(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | TBD |
Returns
Type | Description |
---|---|
ActorSelection | TBD |
AddressTerminated(Address)
TBD
Declaration
protected void AddressTerminated(Address address)
Parameters
Type | Name | Description |
---|---|---|
Address | address | TBD |
AddWatcher(IActorRef, IActorRef)
TBD
Declaration
protected void AddWatcher(IActorRef watchee, IActorRef watcher)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | watchee | TBD |
IActorRef | watcher | TBD |
AttachChild(Props, Boolean, String)
Attaches a child to the current ActorCell.
This method is used in the process of starting actors.
Declaration
public virtual IActorRef AttachChild(Props props, bool isSystemService, string name = null)
Parameters
Type | Name | Description |
---|---|---|
Props | props | The Props this child actor will use. |
Boolean | isSystemService | If |
String | name | The name of the actor being started. Can be |
Returns
Type | Description |
---|---|
IActorRef | A reference to the initialized child actor. |
Exceptions
Type | Condition |
---|---|
InvalidActorNameException | This exception is thrown if the given |
ArgumentException | This exception is thrown if a pre-creation serialization occurred. |
InvalidOperationException | This exception is thrown if the actor tries to create a child while it is terminating or is terminated. |
AutoReceiveMessage(Envelope)
TBD
Declaration
protected virtual void AutoReceiveMessage(Envelope envelope)
Parameters
Type | Name | Description |
---|---|---|
Envelope | envelope | TBD |
Exceptions
Type | Condition |
---|---|
ActorKilledException | This exception is thrown if a Kill message is included in the given |
Become(Receive)
Changes behaviors to the new Receive.
Declaration
public void Become(Receive receive)
Parameters
Type | Name | Description |
---|---|---|
Receive | receive |
Remarks
Forgets any prior behaviors and doesn't maintain a "behavior stack."
See BecomeStacked(Receive) if that's what you want.
BecomeStacked(Receive)
Changes behaviors to the new Receive while maintaining the previous behavior in this actor's "behavior stack."
Declaration
public void BecomeStacked(Receive receive)
Parameters
Type | Name | Description |
---|---|---|
Receive | receive |
Remarks
Most users typically use Become(Receive) so they can avoid having to maintain a behavior stack.
Only use this method if you know what you're doing.
CheckReceiveTimeout(Boolean)
TBD
Declaration
public void CheckReceiveTimeout(bool reschedule = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | reschedule |
ClearActor(ActorBase)
Clears the actor's state and prepares it for GC.
Declaration
protected void ClearActor(ActorBase actor)
Parameters
Type | Name | Description |
---|---|---|
ActorBase | actor | The actor instance. |
Remarks
Used during actor restarts and shutdowns.
ClearActorCell()
Clears all the contents of the ActorCell.
Declaration
protected void ClearActorCell()
Remarks
Used during shutdown.
CreateActorRestartedEvent(Exception)
Overrideable in order to support issues such as https://github.com/petabridge/phobos-issues/issues/82
Declaration
protected virtual ActorRestarted CreateActorRestartedEvent(Exception cause)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause |
Returns
Type | Description |
---|---|
ActorRestarted |
CreateActorStartedEvent()
Overrideable in order to support issues such as https://github.com/petabridge/phobos-issues/issues/82
Declaration
protected virtual ActorStarted CreateActorStartedEvent()
Returns
Type | Description |
---|---|
ActorStarted |
CreateActorStoppedEvent()
Overrideable in order to support issues such as https://github.com/petabridge/phobos-issues/issues/82
Declaration
protected virtual ActorStopped CreateActorStoppedEvent()
Returns
Type | Description |
---|---|
ActorStopped |
CreateNewActorInstance()
Used to create a new instance of the actor from its Props
Declaration
protected virtual ActorBase CreateNewActorInstance()
Returns
Type | Description |
---|---|
ActorBase | A new instance of this actor. |
GetChildByName(String)
Obsolete. Use TryGetChildStatsByName(String, out IChildStats) instead.
Declaration
[Obsolete("Use TryGetChildStatsByName [0.7.1]", true)]
public IInternalActorRef GetChildByName(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | N/A |
Returns
Type | Description |
---|---|
Akka.Actor.IInternalActorRef | N/A |
GetChildren()
Returns all the children of this actor.
Declaration
public IEnumerable<IInternalActorRef> GetChildren()
Returns
Type | Description |
---|---|
IEnumerable<Akka.Actor.IInternalActorRef> |
GetCurrentSelfOrNoSender()
TBD
Declaration
public static IActorRef GetCurrentSelfOrNoSender()
Returns
Type | Description |
---|---|
IActorRef | TBD |
GetCurrentSenderOrNoSender()
Gets the current sender or NoSender
Declaration
public static IActorRef GetCurrentSenderOrNoSender()
Returns
Type | Description |
---|---|
IActorRef |
GetSingleChild(String)
Get a single child matching the name supplied
Declaration
public IInternalActorRef GetSingleChild(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | the child's name |
Returns
Type | Description |
---|---|
Akka.Actor.IInternalActorRef | IInternalActorRef |
Init(Boolean, MailboxType)
Initialize this cell, i.e. set up mailboxes and supervision. The UID must be reasonably different from the previous UID of a possible actor with the same path, which can be achieved by using ThreadLocalRandom
Declaration
public void Init(bool sendSupervise, MailboxType mailboxType)
Parameters
Type | Name | Description |
---|---|---|
Boolean | sendSupervise | TBD |
MailboxType | mailboxType | TBD |
InitChild(IInternalActorRef)
This should only be used privately or when creating the root actor.
Declaration
public ChildRestartStats InitChild(IInternalActorRef actor)
Parameters
Type | Name | Description |
---|---|---|
Akka.Actor.IInternalActorRef | actor | TBD |
Returns
Type | Description |
---|---|
ChildRestartStats | TBD |
Invoke(Envelope)
Invokes the specified envelope.
Declaration
public void Invoke(Envelope envelope)
Parameters
Type | Name | Description |
---|---|---|
Envelope | envelope | The envelope. |
Exceptions
Type | Condition |
---|---|
ActorKilledException | This exception is thrown if a Kill message is included in the given |
PrepareForNewActor()
Clears the state for a new actor instance following a restart.
Declaration
protected void PrepareForNewActor()
PreStart()
Allow extra pre-start initialization in derived classes
Declaration
protected virtual void PreStart()
ReceivedTerminated(Terminated)
TBD
Declaration
protected void ReceivedTerminated(Terminated t)
Parameters
Type | Name | Description |
---|---|---|
Terminated | t | TBD |
ReceiveMessage(Object)
Receives the next message from the mailbox and feeds it to the underlying actor instance.
Declaration
protected virtual void ReceiveMessage(object message)
Parameters
Type | Name | Description |
---|---|---|
Object | message | The message that will be sent to the actor. |
ReceiveMessageForTest(Envelope)
This is only intended to be called from TestKit's TestActorRef
Declaration
public void ReceiveMessageForTest(Envelope envelope)
Parameters
Type | Name | Description |
---|---|---|
Envelope | envelope | TBD |
RemoveChildAndGetStateChange(IActorRef)
TBD
Declaration
protected SuspendReason RemoveChildAndGetStateChange(IActorRef child)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | child | TBD |
Returns
Type | Description |
---|---|
SuspendReason | TBD |
RemWatcher(IActorRef, IActorRef)
TBD
Declaration
protected void RemWatcher(IActorRef watchee, IActorRef watcher)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | watchee | TBD |
IActorRef | watcher | TBD |
ReserveChild(String)
TBD
Declaration
public void ReserveChild(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | TBD |
Restart(Exception)
Restarts the specified cause.
Declaration
public void Restart(Exception cause)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | The cause. |
Remarks
➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
Resume(Exception)
Resumes the specified caused by failure.
Declaration
public void Resume(Exception causedByFailure)
Parameters
Type | Name | Description |
---|---|---|
Exception | causedByFailure | The caused by failure. |
Remarks
➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
SendMessage(Envelope)
Used to send a message to the actor's mailbox.
Declaration
public virtual void SendMessage(Envelope message)
Parameters
Type | Name | Description |
---|---|---|
Envelope | message | The message + sender envelope. |
SendMessage(IActorRef, Object)
Used to send a message to the actor's mailbox.
Declaration
public virtual void SendMessage(IActorRef sender, object message)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | sender | The sender of the message. |
Object | message | The message to send. |
SendSystemMessage(ISystemMessage)
Handles a ISystemMessage
Declaration
public virtual void SendSystemMessage(ISystemMessage systemMessage)
Parameters
Type | Name | Description |
---|---|---|
ISystemMessage | systemMessage | The system message to process. |
Remarks
➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
SetActorFields(ActorBase)
Declaration
protected static void SetActorFields(ActorBase actor)
Parameters
Type | Name | Description |
---|---|---|
ActorBase | actor |
SetChildrenTerminationReason(SuspendReason)
TBD
Declaration
protected bool SetChildrenTerminationReason(SuspendReason reason)
Parameters
Type | Name | Description |
---|---|---|
SuspendReason | reason | TBD |
Returns
Type | Description |
---|---|
Boolean | TBD |
SetReceiveTimeout(Nullable<TimeSpan>)
Sets the receive timeout for this actor - which will trigger a ReceiveTimeout message to be delivered into the actor's mailbox when time is up.
Declaration
public void SetReceiveTimeout(TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
Nullable<TimeSpan> | timeout | The timeframe. If |
SetTerminated()
TBD
Declaration
protected void SetTerminated()
Start()
Starts this instance.
Declaration
public virtual void Start()
Stash(SystemMessage)
TBD
Declaration
protected void Stash(SystemMessage msg)
Parameters
Type | Name | Description |
---|---|---|
SystemMessage | msg | TBD |
Stop()
Async stop this actor
Declaration
public void Stop()
Remarks
➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
Stop(IActorRef)
Stops the specified child.
Declaration
public void Stop(IActorRef child)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | child | The child. |
StopFunctionRefs()
Declaration
protected void StopFunctionRefs()
Suspend()
Suspends this instance.
Declaration
public void Suspend()
Remarks
➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
TellWatchersWeDied()
TBD
Declaration
protected void TellWatchersWeDied()
TerminatedQueuedFor(IActorRef, Option<Object>)
TBD
Declaration
public void TerminatedQueuedFor(IActorRef subject, Option<object> customMessage)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | subject | Tracked subject |
Option<Object> | customMessage | Terminated custom message |
TryGetChildStatsByName(String, out IChildStats)
Tries to get the stats for the child with the specified name. The stats can be either ChildNameReserved indicating that only a name has been reserved for the child, or a ChildRestartStats for a child that has been initialized/created.
Declaration
public bool TryGetChildStatsByName(string name, out IChildStats child)
Parameters
Type | Name | Description |
---|---|---|
String | name | TBD |
IChildStats | child | TBD |
Returns
Type | Description |
---|---|
Boolean | TBD |
TryGetChildStatsByRef(IActorRef, out ChildRestartStats)
Tries to get the stats for the specified child.
Declaration
protected bool TryGetChildStatsByRef(IActorRef actor, out ChildRestartStats child)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | actor | TBD |
ChildRestartStats | child | TBD |
Returns
Type | Description |
---|---|
Boolean | TBD |
UnbecomeStacked()
Used in combination with BecomeStacked(Receive) - used to pop old behaviors off of the stack.
Declaration
public void UnbecomeStacked()
UnreserveChild(String)
TBD
Declaration
protected void UnreserveChild(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | TBD |
Unwatch(IActorRef)
TBD
Declaration
public IActorRef Unwatch(IActorRef subject)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | subject | TBD |
Returns
Type | Description |
---|---|
IActorRef | TBD |
UnwatchWatchedActors(ActorBase)
INTERNAL API
Declaration
protected void UnwatchWatchedActors(ActorBase actor)
Parameters
Type | Name | Description |
---|---|---|
ActorBase | actor |
Remarks
Cleanup routine during actor shutdown.
UseThreadContext(Action)
Performs an activity inside this actor's thread-safe context.
Declaration
public void UseThreadContext(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action | The action to perform. |
Watch(IActorRef)
TBD
Declaration
public IActorRef Watch(IActorRef subject)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | subject | TBD |
Returns
Type | Description |
---|---|
IActorRef | TBD |
WatchedActorTerminated(IActorRef, Boolean, Boolean)
When this actor is watching the subject of Terminated message it will be propagated to user's receive.
Declaration
protected void WatchedActorTerminated(IActorRef actor, bool existenceConfirmed, bool addressTerminated)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | actor | TBD |
Boolean | existenceConfirmed | TBD |
Boolean | addressTerminated | TBD |
WatchWith(IActorRef, Object)
TBD
Declaration
public IActorRef WatchWith(IActorRef subject, object message)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | subject | TBD |
Object | message | TBD |
Returns
Type | Description |
---|---|
IActorRef | TBD |
Explicit Interface Implementations
| Improve this Doc View SourceIActorContext.Child(String)
Declaration
IActorRef IActorContext.Child(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name |
Returns
Type | Description |
---|---|
IActorRef |
IActorContext.GetChildren()
Declaration
IEnumerable<IActorRef> IActorContext.GetChildren()
Returns
Type | Description |
---|---|
IEnumerable<IActorRef> |
IActorContext.Parent
Declaration
IActorRef IActorContext.Parent { get; }
Returns
Type | Description |
---|---|
IActorRef |
IUntypedActorContext.Become(UntypedReceive)
Declaration
void IUntypedActorContext.Become(UntypedReceive receive)
Parameters
Type | Name | Description |
---|---|---|
UntypedReceive | receive |
IUntypedActorContext.BecomeStacked(UntypedReceive)
Declaration
void IUntypedActorContext.BecomeStacked(UntypedReceive receive)
Parameters
Type | Name | Description |
---|---|---|
UntypedReceive | receive |