Actor class

Type that implements an actor. Inherit from this class to declare a custom actor.

public abstract class Actor

Public Members

name description
CurrentEventGroup { get; set; } An optional EventGroup associated with the current event being handled.
override Equals(…) Determines whether the specified object is equal to the current object.
override GetHashCode() Returns the hash code for this instance.
override ToString() Returns a string that represents the current actor.

Protected Members

name description
Actor() Initializes a new instance of the Actor class.
virtual HashedState { get; } User-defined hashed state of the actor. Override to improve the accuracy of stateful techniques during testing.
Id { get; } Unique id that identifies this actor.
Logger { get; } The logger installed to the runtime.
Assert(…) Checks if the assertion holds, and if not, throws an AssertionFailureException exception. (5 methods)
CreateActor(…) Creates a new actor of the specified type and with the specified optional Event. This Event can only be used to access its payload, and cannot be handled. (3 methods)
Monitor(…) Invokes the specified monitor with the specified Event.
Monitor<T>(…) Invokes the specified monitor with the specified Event.
virtual OnEventDeferred(…) Callback that is invoked when the actor defers dequeing an event from its inbox.
virtual OnEventDequeuedAsync(…) Asynchronous callback that is invoked when the actor successfully dequeues an event from its inbox. This method is not called when the dequeue happens via a receive statement.
virtual OnEventHandledAsync(…) Asynchronous callback that is invoked when the actor finishes handling a dequeued event, unless the handler of the dequeued event caused the actor to halt (either normally or due to an exception). The actor will either become idle or dequeue the next event from its inbox.
virtual OnEventIgnored(…) Callback that is invoked when the actor ignores an event and removes it from its inbox.
virtual OnEventUnhandledAsync(…) Asynchronous callback that is invoked when the actor receives an event that it is not prepared to handle. The callback is invoked first, after which the actor will necessarily throw an UnhandledEventException.
virtual OnException(…) Callback that is invoked when the actor throws an exception. By default, the actor throws the exception causing the runtime to fail.
virtual OnExceptionHandledAsync(…) Asynchronous callback that is invoked when the actor handles an exception.
virtual OnHaltAsync(…) Asynchronous callback that is invoked when the actor halts.
virtual OnInitializeAsync(…) Asynchronous callback that is invoked when the actor is initialized with an optional event.
RaiseHaltEvent() Raises a HaltEvent to halt the actor at the end of the current action.
RandomBoolean() Returns a nondeterministic boolean choice, that can be controlled during testing.
RandomInteger(…) Returns a nondeterministic integer, that can be controlled during testing. The value is used to generate an integer in the range [0..maxValue).
ReceiveEventAsync(…) Waits to receive an Event of the specified type that satisfies an optional predicate. (3 methods)
SendEvent(…) Sends an asynchronous Event to a target.
StartPeriodicTimer(…) Starts a periodic timer that sends a TimerElapsedEvent to this actor after the specified due time, and then repeats after each specified period. The timer accepts an optional payload to be used during timeout. The timer can be stopped by invoking the StopTimer method.
StartTimer(…) Starts a timer that sends a TimerElapsedEvent to this actor after the specified due time. The timer accepts an optional payload to be used during timeout. The timer is automatically disposed after it timeouts. To manually stop and dispose the timer, invoke the StopTimer method.
StopTimer(…) Stops and disposes the specified timer.
class OnEventDoActionAttribute Attribute for declaring which action should be invoked to handle a dequeued event of the specified type.

Remarks

See Programming model: asynchronous actors for more information.

See Also