LocalActorRef
in package
implements
ActorRef, BackpressureCapable
Tags
Table of Contents
Interfaces
- ActorRef
- Type-safe reference to an actor — the only handle user code holds.
- BackpressureCapable
- An ActorRef whose sends can report mailbox admission.
Methods
- __construct() : mixed
- ask() : Future<string|int, R>
- Send a message and get a Future for the reply.
- enqueueEnvelope() : void
- Deliver a pre-formed envelope directly to the mailbox.
- isAlive() : bool
- Return true if the actor is still running and able to receive messages.
- offer() : EnqueueResult
- Enqueue a message and report the mailbox admission result.
- offerEnvelope() : EnqueueResult
- Deliver a pre-formed envelope directly to the mailbox, returning the enqueue result.
- path() : ActorPath
- Return the hierarchical path that uniquely identifies this actor in the system.
- tell() : void
- Send a message to the actor without waiting for a reply (fire-and-forget).
Methods
__construct()
public
__construct(ActorPath $path, Mailbox<string|int, Envelope> $mailbox, callable(): bool $aliveChecker, Runtime $runtime, Observability $observability[, DeadLetterRef|null $deadLetters = null ]) : mixed
Parameters
- $path : ActorPath
-
The actor's path in the hierarchy
- $mailbox : Mailbox<string|int, Envelope>
-
The actor's mailbox for message delivery
- $aliveChecker : callable(): bool
-
Closure that checks whether the actor is alive
- $runtime : Runtime
-
Runtime for creating FutureSlots
- $observability : Observability
-
Provider used to inject trace context into outgoing envelopes.
- $deadLetters : DeadLetterRef|null = null
-
Sink for fire-and-forget deliveries the mailbox cannot accept.
ask()
Send a message and get a Future for the reply.
public
ask(T $message, Duration $timeout) : Future<string|int, R>
Parameters
- $message : T
- $timeout : Duration
Tags
Attributes
- #[NoDiscard]
- #[Override]
Return values
Future<string|int, R>enqueueEnvelope()
Deliver a pre-formed envelope directly to the mailbox.
public
enqueueEnvelope(Envelope $envelope) : void
Used by cluster transport to preserve sender path from remote workers.
Parameters
- $envelope : Envelope
isAlive()
Return true if the actor is still running and able to receive messages.
public
isAlive() : bool
Returns false once the actor has stopped or its mailbox has been closed. Messages sent to a stopped actor are forwarded to dead letters.
Attributes
- #[Override]
Return values
booloffer()
Enqueue a message and report the mailbox admission result.
public
offer(T|SystemMessage $message) : EnqueueResult
Parameters
- $message : T|SystemMessage
Attributes
- #[NoDiscard]
- #[Override]
Return values
EnqueueResultofferEnvelope()
Deliver a pre-formed envelope directly to the mailbox, returning the enqueue result.
public
offerEnvelope(Envelope $envelope) : EnqueueResult
Mirrors enqueueEnvelope() but exposes the result so callers can react to backpressure or a dropped delivery without a separate offer() that strips the envelope context (senderRef, correlationId, etc.). Used by the Messenger bridge's ask-aware receiver path to support process-ack with backpressure visibility.
Parameters
- $envelope : Envelope
Attributes
- #[NoDiscard]
Return values
EnqueueResult —Accepted on success, Dropped when the mailbox is closed
path()
Return the hierarchical path that uniquely identifies this actor in the system.
public
path() : ActorPath
Paths have the form /user/parent/child and are stable for the lifetime of the actor. They appear in log output and are used as routing keys in the worker pool and cluster layers.
Attributes
- #[Override]
Return values
ActorPathtell()
Send a message to the actor without waiting for a reply (fire-and-forget).
public
tell(T|SystemMessage $message) : void
Parameters
- $message : T|SystemMessage
Attributes
- #[Override]