Belay.Queues (Belay v1.0.0)

Copy Markdown View Source

Runtime queue management, persisted in the database and applied by every node — no leader, no deploy.

Belay.Queues.put(MyApp.Belay, :imports,
  limit: 10, global_limit: 4, rate: [allowed: 100, period: 60])

Belay.Queues.delete(MyApp.Belay, :imports)
Belay.Queues.list(MyApp.Belay)

Each node's queue-sync process reconciles its local producers against the table every dynamic_sync interval (default 5s): new entries start producers, deletions stop them, changed options restart them. A dynamic entry with the same name as a static queue overrides it. Options are validated on put/3, so a bad entry never reaches producers.

Summary

Functions

Delete a dynamic queue. Its node-local producers stop on the next sync.

List dynamic queues as {name, opts} pairs.

Create or update a dynamic queue. Options as in the static config.

Functions

delete(name, queue)

@spec delete(GenServer.name(), atom() | String.t()) :: :ok

Delete a dynamic queue. Its node-local producers stop on the next sync.

list(name)

@spec list(GenServer.name()) :: [{String.t(), keyword()}]

List dynamic queues as {name, opts} pairs.

put(name, queue, opts)

@spec put(GenServer.name(), atom() | String.t(), keyword()) :: :ok

Create or update a dynamic queue. Options as in the static config.