Table Of Contents

Actors in the Actor Framework

Last Modified: February 27, 2020

In the Actor Framework, an Actor is an object that represents the state of an independently running VI. Because the Actor object is contained within the running VI and all outside access is done by sending Messages to the VI, the term Actor is also used for the VI itself.

All Actor classes inherit from the Actor parent class. An Actor object is a normal by-value, dataflow object with accessors and methods. You can make any existing by-value class into an Actor by setting it to inherit from the Actor parent class. The Actor parent class provides exactly one public method called Launch Root Actor. This method uses VI Server to launch an independent reentrant clone of the private method, Actor, which defines a queue-driven state machine (QDSM).

The Launch Root Actor VI has two inputs, the initial Actor object and an error in, and it returns a new queue reference. Use the queue reference to pass Messages from the launched clone, the nested Actor, back to the caller. Use the output queue to pass Messages from the caller into the nested Actor.

When the Launch Root Actor VI passes the Actor object to the Actor VI, the Actor object becomes unavailable to the caller. Instead, callers must communicate with the Actor object through Messages in Message queues.

The Actor VI calls the Actor Core VI. The Actor Core VI is a QDSM and a dynamic dispatch VI with a protected scope. As each Message arrives, the Message invokes methods on the Actor. The state machine stops on an error and all errors propagate up to callers except error code 1752. A child class can override the Actor Core VI if the override VI invokes the Call Parent VI. Because the Call Parent VI runs the state machine, ensure it runs in parallel with other operations you add in the override VI. The override VI can include a user interface, calls to launch nested Actors, or additional control logic for the state machine.

Recently Viewed Topics