Shared queue configuration fields (see QueueHyperlinkConfig).
export interface interface QueueHyperlinkConfigBase<T>Shared queue configuration fields (see
QueueHyperlinkConfig
).
QueueHyperlinkConfigBase<function (type parameter) T in QueueHyperlinkConfigBase<T>T> {
/** Queue name used for log annotations and error messages. @default "anonymous" */
readonly QueueHyperlinkConfigBase<T>.name?: string | undefinedQueue name used for log annotations and error messages.
name?: string;
/** Start with processing paused. Call `resume` to begin. @default false */
readonly QueueHyperlinkConfigBase<T>.paused?: boolean | undefinedStart with processing paused. Call resume to begin.
paused?: boolean;
/**
* When `false`, worker fibers are **not** forked until
* {@link QueueHandleApi.start} runs. Enqueue still succeeds; items accumulate until workers exist.
* `pause` / `resume` update the latch before or after `start` — workers observe it once forked.
*
* @default true (preserve historic behavior: fork workers as soon as the queue scope acquires).
*/
readonly QueueHyperlinkConfigBase<T>.autoStart?: boolean | undefinedWhen false, worker fibers are not forked until
QueueHandleApi.start
runs. Enqueue still succeeds; items accumulate until workers exist.
pause / resume update the latch before or after start — workers observe it once forked.
autoStart?: boolean;
/** Max items processing concurrently (worker count). @default 5 */
readonly QueueHyperlinkConfigBase<T>.concurrency?: number | undefinedMax items processing concurrently (worker count).
concurrency?: number;
/**
* Optional Effect `RateLimiter` on item workers (before concurrency semaphore).
* Omitted = no rate limit (only `concurrency`).
*/
readonly QueueHyperlinkConfigBase<T>.rateLimit?: QueueHyperlinkRateLimitOptionsOptional Effect RateLimiter on item workers (before concurrency semaphore).
Omitted = no rate limit (only concurrency).
rateLimit?: type QueueHyperlinkRateLimitOptions =
Omit<
{
readonly algorithm?:
| "fixed-window"
| "token-bucket"
| undefined
readonly onExceeded?:
| "delay"
| "fail"
| undefined
readonly window: Duration.Input
readonly limit: number
readonly key: string
readonly tokens?: number | undefined
},
"key"
> & {
readonly key?: string
}
Effect
RateLimiter.consume
options for queue workers, with optional
key (defaults to queue name) and telemetry controls.
QueueHyperlinkRateLimitOptions;
/** Max items per priority queue (bounded backpressure). @default 50_000 */
readonly QueueHyperlinkConfigBase<T>.capacity?: number | undefinedMax items per priority queue (bounded backpressure).
capacity?: number;
/**
* Number of priority lanes. The default queue uses 3 (`high`=0, `normal`=1, `low`=2).
*
* @default 3
*/
readonly QueueHyperlinkConfigBase<T>.levelCount?: number | undefinedNumber of priority lanes. The default queue uses 3 (high=0, normal=1, low=2).
levelCount?: number;
/**
* How workers pick among non-empty lanes when taking the next item. `"priority"` is strict
* lowest-index-first (the default 3-level behavior). `"weighted"` and `"strict-descending"`
* apply to all configured levels; a {@link CustomTakeAlgorithm} function is also accepted.
*
* @default "priority"
*/
readonly QueueHyperlinkConfigBase<T>.takeAlgorithm?: TakeAlgorithmHow workers pick among non-empty lanes when taking the next item. "priority" is strict
lowest-index-first (the default 3-level behavior). "weighted" and "strict-descending"
apply to all configured levels; a
CustomTakeAlgorithm
function is also accepted.
takeAlgorithm?: type TakeAlgorithm = TakeAlgorithmInternalLane take algorithm: a built-in name or a custom pick function.
TakeAlgorithm;
/**
* Extract a deduplication key from each item. When set, items with a key
* already in-flight (enqueued or processing) are silently dropped.
* The key is released after the worker `effect` completes.
*/
readonly QueueHyperlinkConfigBase<T>.key?: ((item: T) => string) | undefinedExtract a deduplication key from each item. When set, items with a key
already in-flight (enqueued or processing) are silently dropped.
The key is released after the worker effect completes.
key?: (item: Titem: function (type parameter) T in QueueHyperlinkConfigBase<T>T) => string;
/**
* Max **attempts** for an item — the initial try plus automatic re-enqueues. On failure the
* worker re-enqueues the item at its **own priority**, preserving its attempt count, until
* `attempts` is reached; then it's exhausted (emits a `RetryExhausted` event). Observe the
* `RetryScheduled` / `RetryExhausted` lifecycle on the {@link QueueHandleApi.events} stream.
*
* In-place retry of the worker effect is a separate concern — put `Effect.retry(...)` on your
* `effect`.
*
* @default 1 (try once; no auto re-enqueue)
*/
readonly QueueHyperlinkConfigBase<T>.attempts?: number | undefinedMax attempts for an item — the initial try plus automatic re-enqueues. On failure the
worker re-enqueues the item at its own priority, preserving its attempt count, until
attempts is reached; then it's exhausted (emits a RetryExhausted event). Observe the
RetryScheduled / RetryExhausted lifecycle on the
QueueHandleApi.events
stream.
In-place retry of the worker effect is a separate concern — put Effect.retry(...) on your
effect.
attempts?: number;
/**
* How {@link QueueHandleApi.shutdown} winds down. Either way it stops accepting new items
* immediately (status `phase` → `"draining"`), lets in-flight items finish, and once the queue
* is empty + idle emits `ShutdownComplete` and sets `phase` → `"off"`. They differ on the
* **already-queued** items:
* - `"drain"` — process the remaining queued items first (graceful; nothing is lost). **Default.**
* - `"finishActive"` — discard the queued items (emit a `Dropped` event for them) and only let
* the in-flight ones finish (fast stop; with future persistence the discarded items are what a
* restart would rebuild).
*
* @default "drain"
*/
readonly QueueHyperlinkConfigBase<T>.shutdownMode?: "drain" | "finishActive" | undefinedHow
QueueHandleApi.shutdown
winds down. Either way it stops accepting new items
immediately (status phase → "draining"), lets in-flight items finish, and once the queue
is empty + idle emits ShutdownComplete and sets phase → "off". They differ on the
already-queued items:
"drain" — process the remaining queued items first (graceful; nothing is lost). Default.
"finishActive" — discard the queued items (emit a Dropped event for them) and only let
the in-flight ones finish (fast stop; with future persistence the discarded items are what a
restart would rebuild).
shutdownMode?: "drain" | "finishActive";
}