effect-io-ai

Package: effect
Module: TxQueue

TxQueue.unbounded

Creates a new unbounded TxQueue with unlimited capacity.

Details

This function returns a new TxQueue reference with unlimited capacity. No existing TxQueue instances are modified.

Example (Creating unbounded queues)

import { Effect, TxQueue } from "effect"

const program = Effect.gen(function*() {
  // Create an unbounded queue (E defaults to never)
  const queue = yield* TxQueue.unbounded<string>()

  // Create an unbounded queue with error channel
  const faultTolerantQueue = yield* TxQueue.unbounded<string, Error>()

  // Can offer unlimited items
  yield* TxQueue.offer(queue, "hello")
  yield* TxQueue.offer(queue, "world")

  const size = yield* TxQueue.size(queue)
  console.log(size) // 2
})

Signature

declare const unbounded: <A = never, E = never>() => Effect.Effect<TxQueue<A, E>>

Source

Since v2.0.0