Class ActorBase
Class ActorBase.
Inheritance
Implements
Inherited Members
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public abstract class ActorBase : IInternalActor
Constructors
| Improve this Doc View SourceActorBase()
Initializes a new instance of the ActorBase class.
Declaration
protected ActorBase()
Exceptions
Type | Condition |
---|---|
ActorInitializationException | This exception is thrown when an actor is created using |
Properties
| Improve this Doc View SourceContext
Gets the context.
Declaration
protected static IActorContext Context { get; }
Property Value
Type | Description |
---|---|
IActorContext | The context. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | This exception is thrown if there is no active Context. The most likely cause is due to use of async operations from within this actor. |
EmptyReceive
EmptyReceive is a Receive-delegate that matches no messages at all, ever.
Declaration
protected static Receive EmptyReceive { get; }
Property Value
Type | Description |
---|---|
Receive |
Self
Gets the self ActorRef
Declaration
protected IActorRef Self { get; }
Property Value
Type | Description |
---|---|
IActorRef | Self ActorRef |
Sender
Gets the sending ActorRef of the current message
Declaration
protected IActorRef Sender { get; }
Property Value
Type | Description |
---|---|
IActorRef | The sender ActorRef |
Methods
| Improve this Doc View SourceAroundPostRestart(Exception, Object)
Can be overridden to intercept calls to PostRestart
. Calls PostRestart
by default.
Declaration
public virtual void AroundPostRestart(Exception cause, object message)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | The cause. |
Object | message | The message. |
AroundPostStop()
Can be overridden to intercept calls to PostStop
. Calls PostStop
by default..
Declaration
public virtual void AroundPostStop()
AroundPreRestart(Exception, Object)
Can be overridden to intercept calls to PreRestart
. Calls PreRestart
by default.
Declaration
public virtual void AroundPreRestart(Exception cause, object message)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | The cause. |
Object | message | The message. |
AroundPreStart()
Can be overridden to intercept calls to PreStart
. Calls PreStart
by default.
Declaration
public virtual void AroundPreStart()
AroundReceive(Receive, Object)
TBD
Declaration
protected virtual bool AroundReceive(Receive receive, object message)
Parameters
Type | Name | Description |
---|---|---|
Receive | receive | TBD |
Object | message | TBD |
Returns
Type | Description |
---|---|
Boolean | TBD |
Become(Receive)
Changes the actor's command behavior and replaces the current receive handler with the specified handler.
Declaration
protected 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
protected void BecomeStacked(Receive receive)
Parameters
Type | Name | Description |
---|---|---|
Receive | receive | The new message handler. |
PostRestart(Exception)
User overridable callback: By default it calls PreStart()
.
Is called right AFTER restart on the newly created Actor to allow reinitialization after an Actor crash.
Declaration
protected virtual void PostRestart(Exception reason)
Parameters
Type | Name | Description |
---|---|---|
Exception | reason | the Exception that caused the restart to happen. |
PostStop()
User overridable callback.
Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.
Declaration
protected virtual void PostStop()
PreRestart(Exception, Object)
User overridable callback: '''By default it disposes of all children and then calls postStop()
.'''
Is called on a crashed Actor right BEFORE it is restarted to allow clean up of resources before Actor is terminated.
Declaration
protected virtual void PreRestart(Exception reason, object message)
Parameters
Type | Name | Description |
---|---|---|
Exception | reason | the Exception that caused the restart to happen. |
Object | message | optionally the current message the actor processed when failing, if applicable. |
PreStart()
User overridable callback.
Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.
Declaration
protected virtual void PreStart()
Receive(Object)
Processor for user defined messages.
Declaration
protected abstract bool Receive(object message)
Parameters
Type | Name | Description |
---|---|---|
Object | message | The message. |
Returns
Type | Description |
---|---|
Boolean | TBD |
SetReceiveTimeout(Nullable<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
protected void SetReceiveTimeout(TimeSpan? timeout)
Parameters
Type | Name | Description |
---|---|---|
Nullable<TimeSpan> | timeout | The timeout. Pass in |
SupervisorStrategy()
TBD
Declaration
protected virtual SupervisorStrategy SupervisorStrategy()
Returns
Type | Description |
---|---|
SupervisorStrategy | TBD |
UnbecomeStacked()
Reverts the Actor behavior to the previous one on the behavior stack.
Declaration
protected void UnbecomeStacked()
Unhandled(Object)
Is called when a message isn't handled by the current behavior of the actor by default it fails with either a DeathPactException (in case of an unhandled Terminated message) or publishes an UnhandledMessage to the actor's system's EventStream
Declaration
protected virtual void Unhandled(object message)
Parameters
Type | Name | Description |
---|---|---|
Object | message | The unhandled message. |
Exceptions
Type | Condition |
---|---|
DeathPactException | This exception is thrown if the given |
Explicit Interface Implementations
| Improve this Doc View SourceIInternalActor.ActorContext
Gets the context.
Declaration
IActorContext IInternalActor.ActorContext { get; }
Returns
Type | Description |
---|---|
IActorContext | The context. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | This exception is thrown if there is no active ActorContext. The most likely cause is due to use of async operations from within this actor. |