Nexus API Reference

InMemoryWorkerTransport
in package
implements WorkerTransport

FinalYes
Tags
psalm-api

Table of Contents

Interfaces

WorkerTransport

Methods

close()  : void
Close the transport and release resources.
getSent()  : array<int, Envelope}>
getSentTo()  : array<int, Envelope>
isStopped()  : bool
Whether stop() has been called on this transport.
listen()  : void
Register a listener for incoming envelopes.
receive()  : void
Simulate receiving an envelope (for testing).
send()  : void
Send an envelope to the target worker.
stop()  : void
Signal the transport to stop. The receive loop exits cooperatively on its next backoff wakeup (within ~10ms in the worst case).

Methods

getSentTo()

public getSentTo(int $workerId) : array<int, Envelope>
Parameters
$workerId : int
Return values
array<int, Envelope>

isStopped()

Whether stop() has been called on this transport.

public isStopped() : bool
Return values
bool

listen()

Register a listener for incoming envelopes.

public listen(callable $onEnvelope) : void
Parameters
$onEnvelope : callable

receive()

Simulate receiving an envelope (for testing).

public receive(Envelope $envelope) : void
Parameters
$envelope : Envelope

send()

Send an envelope to the target worker.

public send(int $targetWorker, Envelope $envelope) : void
Parameters
$targetWorker : int
$envelope : Envelope

stop()

Signal the transport to stop. The receive loop exits cooperatively on its next backoff wakeup (within ~10ms in the worst case).

public stop() : void

Idempotent — calling stop() on an already-stopped transport is a no-op.

Required for graceful shutdown: without stop(), the receive loop blocks indefinitely and the worker cannot exit cleanly.


        
On this page

Search results