Nexus API Reference

StepMailbox
in package
implements Mailbox

FinalYes

Deterministic mailbox for the StepRuntime.

Unlike FiberMailbox, dequeueBlocking() ALWAYS suspends the fiber before checking the queue. This guarantees that each message requires an explicit step() call from the test to be processed.

Tags
psalm-api
template
implements

Table of Contents

Interfaces

Mailbox

Methods

__construct()  : mixed
close()  : void
Close the mailbox. Subsequent enqueue() calls return EnqueueResult::Dropped without raising. Blocked dequeueBlocking() calls return null once the mailbox drains (closed-and-empty).
count()  : int
dequeue()  : T|null
dequeueBlocking()  : T
Always suspends the fiber, then checks for messages on resume.
enqueue()  : EnqueueResult
getWaitingFiber()  : Fiber<mixed, mixed>|null
hasWaitingFiber()  : bool
isClosed()  : bool
isEmpty()  : bool
isFull()  : bool

Methods

close()

Close the mailbox. Subsequent enqueue() calls return EnqueueResult::Dropped without raising. Blocked dequeueBlocking() calls return null once the mailbox drains (closed-and-empty).

public close() : void

Idempotent — calling close() on an already-closed mailbox is a no-op.

Required by Plan 5 (graceful shutdown). Without close(), the actor's message loop has no way to wake up cleanly when the system stops.

Attributes
#[Override]

count()

public count() : int
Attributes
#[Override]
Return values
int

dequeue()

public dequeue() : T|null
Attributes
#[Override]
Return values
T|null

dequeueBlocking()

Always suspends the fiber, then checks for messages on resume.

public dequeueBlocking(Duration $timeout) : T

This ensures exactly one message is processed per step() call.

Parameters
$timeout : Duration
Tags
throws
MailboxClosedException
Attributes
#[Override]
Return values
T

getWaitingFiber()

public getWaitingFiber() : Fiber<mixed, mixed>|null
Return values
Fiber<mixed, mixed>|null

hasWaitingFiber()

public hasWaitingFiber() : bool
Return values
bool

isClosed()

public isClosed() : bool
Attributes
#[Override]
Return values
bool

isEmpty()

public isEmpty() : bool
Attributes
#[Override]
Return values
bool

isFull()

public isFull() : bool
Attributes
#[Override]
Return values
bool
On this page

Search results