effect-io-ai

Package: effect
Module: PubSub

PubSub.makeAtomicBounded

Creates a bounded atomic PubSub implementation with optional replay buffer.

When to use

Use to provide bounded message storage when building a custom PubSub with make and an explicit delivery strategy.

Details

Pass either a capacity number or an options object with capacity and optional replay. A positive replay value enables a replay buffer for late subscribers, and fractional replay sizes are rounded up.

Gotchas

The capacity must be greater than zero; invalid capacities throw synchronously before an atomic implementation is created.

See

Signature

declare const makeAtomicBounded: <A>(capacity: number | { readonly capacity: number; readonly replay?: number | undefined; }) => PubSub.Atomic<A>

Source

Since v4.0.0