shigoto_fanout_queue (shigoto v1.9.10)

View Source

Fanout queue — every node processes every job. Used for broadcast events like session revocation, notifications, and cross-node chat.

Unlike the standard queue which uses FOR UPDATE SKIP LOCKED (single consumer), fanout queues let all nodes read the same jobs. Each node tracks which job IDs it has already processed in a local ETS table.

Jobs are read within a time window (default 120s). Older jobs are ignored. On node restart, the ETS is empty so recent jobs within the window are re-processed — workers must be idempotent.

The source of truth is always the database. Fanout is best-effort push; if a node misses a job, the client catches up on reconnect.

Summary

Functions

handle_call/3

handle_cast/2

handle_info/2

init/1

start_link(Queue, Concurrency, Opts)

-spec start_link(binary(), pos_integer(), map()) -> {ok, pid()}.

terminate/2