ClusterSingletonProxy
이 콘텐츠는 아직 번역되지 않았습니다.
Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:24
Location-transparent handle to a cluster-wide singleton. Every call to
tell looks up the current host and forwards to that node’s
ClusterSingletonManager (via direct tell if local, via envelope if
remote). Messages sent before the cluster has a host are
buffered and drained when the first LeaderChanged event fires.
The proxy extends ActorRef
Extends
Section titled “Extends”ActorRef<TCommand>
Type Parameters
Section titled “Type Parameters”TCommand
Section titled “TCommand”TCommand
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ClusterSingletonProxy<
TCommand>(cluster,key,localManager,role?,bufferSize?):ClusterSingletonProxy<TCommand>
Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:34
Parameters
Section titled “Parameters”cluster
Section titled “cluster”SingletonKey<TCommand>
localManager
Section titled “localManager”() => ActorRef<unknown> | null
This node’s manager, resolved per delivery rather than captured. A
proxy handed out by ClusterSingleton.ref predates any local start()
— and a start() may follow on this node later — so a captured ref
would either be impossible to obtain or permanently stale.
string | undefined
Role restriction, if any — must be the same one the managers were started with, or this proxy and they disagree about who hosts. Defaults to the key’s, which is why the key carries it.
bufferSize?
Section titled “bufferSize?”number = DEFAULT_BUFFER_SIZE
Cap on the no-host buffer. See DEFAULT_BUFFER_SIZE.
Returns
Section titled “Returns”ClusterSingletonProxy<TCommand>
Overrides
Section titled “Overrides”Properties
Section titled “Properties”droppedCount
Section titled “droppedCount”droppedCount:
number=0
Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:32
Messages dropped because the no-host buffer was full — useful for metrics.
readonlypath:ActorPath
Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:25
Overrides
Section titled “Overrides”Methods
Section titled “Methods”ask<
TResponse>(message,timeoutMs?):Promise<TResponse>
Defined in: src/ActorRef.ts:77
Request/response — send message and await the recipient’s reply.
The framework synthesises a one-shot reply ref, injects it as both
the sender slot and as message.replyTo, and resolves the returned
promise with the first reply (or rejects with AskTimeoutError).
The caller never specifies replyTo on the message — the OmitReplyTo
type subtracts it from the parameter type if the recipient declares it.
const value = await counter.ask<number>({ kind: 'get' });Type Parameters
Section titled “Type Parameters”TResponse
Section titled “TResponse”TResponse = unknown
Parameters
Section titled “Parameters”message
Section titled “message”OmitReplyTo<TCommand>
timeoutMs?
Section titled “timeoutMs?”number = DEFAULT_ASK_TIMEOUT_MS
Returns
Section titled “Returns”Promise<TResponse>
Inherited from
Section titled “Inherited from”equals()
Section titled “equals()”equals(
other):boolean
Defined in: src/ActorRef.ts:104
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”hasPending()
Section titled “hasPending()”hasPending():
boolean
Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:154
True if at least one message is currently buffered.
Returns
Section titled “Returns”boolean
kill()
Section titled “kill()”kill():
void
Defined in: src/ActorRef.ts:100
Kill this actor — raises ActorKilledError through the normal supervision path.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”send()
Section titled “send()”send(
message):void
Defined in: src/ActorRef.ts:64
Alias for tell — useful if you want to pipe something.
Parameters
Section titled “Parameters”message
Section titled “message”TCommand
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”stop()
Section titled “stop()”stop():
void
Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:117
A singleton is not stopped by poisoning its proxy — the proxy is a
forwarder, not the actor. ActorRef.stop() means “send a PoisonPill to
the target” everywhere else, and doing that here would kill whatever the
current leader happens to be hosting. Overridden to say so instead.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”tell()
Section titled “tell()”tell(
message,_sender?):void
Defined in: src/cluster/singleton/ClusterSingletonProxy.ts:69
Send a message to this actor. sender is surfaced as context.sender in the recipient.
Parameters
Section titled “Parameters”message
Section titled “message”TCommand
_sender?
Section titled “_sender?”ActorRef<unknown> | null
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”toString()
Section titled “toString()”toString():
string
Defined in: src/ActorRef.ts:102
Returns
Section titled “Returns”string
