ActorSystem
Este conteúdo não está disponível em sua língua ainda.
Defined in: src/ActorSystem.ts:70
The ActorSystem is the top-level container for actors. It owns the root guardians, the event stream, the scheduler, and the default dispatcher. Create one per logical application.
Properties
Section titled “Properties”config
Section titled “config”
readonlyconfig:Config
Defined in: src/ActorSystem.ts:78
Full merged configuration in effect for this system.
deadLetters
Section titled “deadLetters”
readonlydeadLetters:ActorRef
Defined in: src/ActorSystem.ts:76
dispatcher
Section titled “dispatcher”
readonlydispatcher:Dispatcher
Defined in: src/ActorSystem.ts:72
eventStream
Section titled “eventStream”
readonlyeventStream:EventStream
Defined in: src/ActorSystem.ts:74
extensions
Section titled “extensions”
readonlyextensions:Extensions
Defined in: src/ActorSystem.ts:80
Per-system extension registry (serialization, sharding, pubsub, …).
readonlylog:Logger
Defined in: src/ActorSystem.ts:75
readonlyname:string
Defined in: src/ActorSystem.ts:71
scheduler
Section titled “scheduler”
readonlyscheduler:Scheduler
Defined in: src/ActorSystem.ts:73
Accessors
Section titled “Accessors”isTerminated
Section titled “isTerminated”Get Signature
Section titled “Get Signature”get isTerminated():
boolean
Defined in: src/ActorSystem.ts:273
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”actorSelection()
Section titled “actorSelection()”actorSelection(
path):ActorSelection
Defined in: src/ActorSystem.ts:228
Build an ActorSelection that resolves a path at lookup time. Accepts
- a fully-qualified URI (“actor-ts://sys/user/foo/bar”)
- an absolute path (“/user/foo/bar” or “user/foo/bar”) Wildcards are not supported in v1.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”extension()
Section titled “extension()”extension<
T>(id):T
Defined in: src/ActorSystem.ts:144
Convenience shortcut for system.extensions.get(id) — the one-liner
used throughout the codebase to resolve an extension by its id.
Type Parameters
Section titled “Type Parameters”T extends Extension
Parameters
Section titled “Parameters”ExtensionId<T>
Returns
Section titled “Returns”T
http()
Section titled “http()”http(
port,opts?):ServerBuilder
Defined in: src/ActorSystem.ts:165
Shortcut — bind an HTTP server on port (and optionally host)
with the framework’s default Fastify backend. Equivalent to:
system.extension(HttpExtensionId) .newServerAt(host ?? '0.0.0.0', port) .useBackend(backend ?? new FastifyBackend())For non-default backends, pass backend: — typically
new ExpressBackend(opts) or new HonoBackend(opts). Returns
the ServerBuilder so you can chain .bind(routes):
const binding = await system.http(8080).bind(routes);Note — FastifyBackend is a hard dependency of the framework
(not a peer-dep), so the default path needs no extra installs.
Parameters
Section titled “Parameters”number
backend?
Section titled “backend?”string
Returns
Section titled “Returns”spawn()
Section titled “spawn()”spawn<
T>(props,name):ActorRef<T>
Defined in: src/ActorSystem.ts:181
Spawn a top-level user actor under /user with a deterministic
caller-supplied name. The name must be unique among siblings
(i.e. children of /user) — if a child with the same name
already exists, the call throws.
For an auto-generated name, see spawnAnonymous.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”Props<T>
string
Returns
Section titled “Returns”ActorRef<T>
spawnAnonymous()
Section titled “spawnAnonymous()”spawnAnonymous<
T>(props):ActorRef<T>
Defined in: src/ActorSystem.ts:194
Spawn a top-level user actor under /user with an auto-generated name. Use when the caller doesn’t care about the path — e.g. one-shot async work, throwaway helpers. For a deterministic name, see spawn.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”Props<T>
Returns
Section titled “Returns”ActorRef<T>
spawnTyped()
Section titled “spawnTyped()”spawnTyped<
T>(behavior,name):ActorRef<T>
Defined in: src/ActorSystem.ts:209
Spawn a typed Behavior under /user with a deterministic name —
the Behavior-DSL counterpart to spawn. Wraps the Behavior
in typedProps(behavior) so callers don’t have to thread Props
through the typed API.
const ref = system.spawnTyped(counter(0), 'counter');Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”behavior
Section titled “behavior”Behavior<T>
string
Returns
Section titled “Returns”ActorRef<T>
spawnTypedAnonymous()
Section titled “spawnTypedAnonymous()”spawnTypedAnonymous<
T>(behavior):ActorRef<T>
Defined in: src/ActorSystem.ts:218
Anonymous variant of spawnTyped — the Behavior-DSL counterpart to spawnAnonymous. Pick this when the caller doesn’t need a stable path.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”behavior
Section titled “behavior”Behavior<T>
Returns
Section titled “Returns”ActorRef<T>
stop()
Section titled “stop()”stop(
ref):void
Defined in: src/ActorSystem.ts:252
Stop any actor by reference. Returns a promise that resolves once it is fully terminated.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
terminate()
Section titled “terminate()”terminate():
Promise<void>
Defined in: src/ActorSystem.ts:257
Shut down: stops /user (children first) and resolves once everything is drained.
Returns
Section titled “Returns”Promise<void>
whenTerminated()
Section titled “whenTerminated()”whenTerminated():
Promise<void>
Defined in: src/ActorSystem.ts:266
Promise that resolves when the system has finished shutting down.
Returns
Section titled “Returns”Promise<void>
create()
Section titled “create()”
staticcreate(name?,settings?):ActorSystem
Defined in: src/ActorSystem.ts:136
Create a new actor system.
Parameters
Section titled “Parameters”string = 'default'
settings?
Section titled “settings?”ActorSystemSettings = {}
Returns
Section titled “Returns”ActorSystem