Create a child instance of an actor binding and return its stub — one worker per job, minted from inside the agent that needs it. The child is a deliberately created instance owned by this agent, not one materialized by addressing a name. It is the same stubprotectedspawn<T>(namespace,name?):Promise<ActorStub&PublicMethods<T>>
binding.idFromName(...) hands back, typed against the bound class, so
calling it is ordinary actor RPC:
name and the child gets a fresh, collision-free one; keep the
returned stub’s id if you need to reach that child again later.
name is a routing name in your own vocabulary — an order id, an E.164
number, an email — and is encoded into an addressable actor id for you, by
the same encoder the front door uses, so a name and its child agree on one
instance no matter which side minted it. A name with no faithful id (empty,
or one that encodes too long to address) is refused here, before
anything is created, with a TypeError naming the name and the limit: a
child under an unaddressable id would take writes and then fail to come
back the first time it is evicted.
Room is finite. When this agent is already at its cap the platform refuses,
and the refusal arrives as a QuotaExceededError you can catch at
this call site — nothing is created when it throws:
spawn must rename it (or align its signature to override this
method).
Type Parameters
Parameters
Returns
Promise<ActorStub & PublicMethods<T>>
The child’s stub, typed against the bound actor class.
Throws
TypeError when name has no addressable actor id, or when the
binding cannot create instances.
Throws
QuotaExceededError when creating the child would exceed a
limit already reached.
QuotaExceededError
Thrown when the platform refuses to create a new actor instance because a limit is already reached — the parent’s cap on how many children it may hold, or an account-wide cap on instances. It is an ordinary application error, raised at the call site that asked for the instance, so it can be caught, logged, and reported like any other:instanceof, or with err.name === "QuotaExceededError"
where the error crossed a boundary that rebuilt it from its name.
Nothing was created when this is thrown: the refusal happens before the
instance exists, so there is no half-made child to clean up. Retrying the
same call only succeeds once room is freed.
Extends
Error
Properties
constructor
new QuotaExceededError(Parametersargs):QuotaExceededError
Returns
QuotaExceededError
Overrides
Error.constructor
code
The machine-readable code from the refusal, when it carried one.readonlycode:string|undefined
detail
The human-readable detail from the refusal, when it carried one.readonlydetail:string|undefined
status
The HTTP status the refusal arrived with.readonlystatus:number