MessageQueue
Defined in: primitives/message-queue.ts:61
A FIFO queue of Messages for the loop's steering / follow-up seams —
the unbounded specialization of BoundedBuffer (capacity: Infinity),
so the overflow policy never engages and it behaves as a plain FIFO.
Remarks
Pure and host-agnostic: no timers, no I/O. drain returns messages in the order they were pushed and removes what it returns, so it plugs straight into Hooks.drainSteering / Hooks.drainFollowUp — which expect exactly "the messages to inject now, having consumed them".
Reach for BoundedBuffer directly when you need a cap and an overflow policy — e.g. a live-ingress dispatcher queue or outbound reply coalescing.
Extends
Accessors
dropped
Get Signature
get dropped(): number;Defined in: primitives/bounded-buffer.ts:170
Total items dropped (evicted + refused) over this buffer's lifetime.
Returns
number
Inherited from
highWater
Get Signature
get highWater(): number;Defined in: primitives/bounded-buffer.ts:175
The largest size this buffer has reached — the backpressure read.
Returns
number
Inherited from
size
Get Signature
get size(): number;Defined in: primitives/bounded-buffer.ts:165
Number of items currently buffered.
Returns
number
Inherited from
Constructors
Constructor
new MessageQueue(options?): MessageQueue;Defined in: primitives/message-queue.ts:65
Parameters
| Parameter | Type | Description |
|---|---|---|
options | MessageQueueOptions | Drain policy; see MessageQueueOptions. |
Returns
MessageQueue
Overrides
Methods
clear()
clear(): void;Defined in: primitives/bounded-buffer.ts:235
Drop every buffered item. Does not reset dropped / highWater.
Returns
void
Inherited from
drain()
drain(): Message[];Defined in: primitives/bounded-buffer.ts:228
Remove and return buffered items per mode: the single oldest item
for "one-at-a-time", or every buffered item for "all". Returns an empty
array when empty — safe to pass directly as a drain hook.
Returns
Message[]
The drained items in FIFO order.
Inherited from
push()
push(...items): PushResult<Message>;Defined in: primitives/bounded-buffer.ts:186
Push one or more items at the back of the buffer, applying the OverflowPolicy per item when at capacity.
Parameters
| Parameter | Type | Description |
|---|---|---|
...items | Message[] | The item(s) to push, in order. |
Returns
A PushResult accounting for every pushed item.
Inherited from
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
mode | DrainMode | Drain policy — mutable so a caller can switch one-at-a-time/all at runtime. | BoundedBuffer.mode | primitives/bounded-buffer.ts:143 |