createActor(logic), you implicitly create an actor system where the created actor is the root actor. Any actors spawned from this root actor and its descendants are part of that actor system.
Signature
Parameters
The actor logic to create an actor from.Actor logic can be:
- A state machine created with
createMachine() - Promise logic created with
fromPromise() - Callback logic created with
fromCallback() - Observable logic created with
fromObservable()orfromEventObservable() - Transition logic created with
fromTransition()
Optional configuration for the actor.
Returns
An
Actor instance that can receive events, send events, and change its behavior.Examples
Creating and starting an actor
Actor with input
Actor with inspection
Persisting and restoring actor state
Using different actor logics
Notes
- Actors must be started with
.start()before they can receive events or emit snapshots - Only root actors (those without a parent) can be stopped with
.stop() - When an actor is stopped, all of its observers are automatically unsubscribed
- The actor system is created when the root actor is created and manages all spawned child actors
See also
- createMachine() - Create state machine logic
- Actor class - Full Actor API reference
- fromPromise() - Create promise-based actors
- fromCallback() - Create callback-based actors