HareMq.GlobalNodeManager (hare_mq v1.4.0)

Copy Markdown

Summary

Functions

Waits until the :global name registry is synchronized across all connected nodes before returning, with a 30-second timeout.

Functions

wait_for_all_nodes_ready(name)

Waits until the :global name registry is synchronized across all connected nodes before returning, with a 30-second timeout.

Two cases:

  • Single-node (Node.list() is empty) — no remote nodes to synchronize with, so we return immediately. :global registration on a single node is always instantaneous.

  • Multi-node — we call :global.sync/0 which blocks until the registry has been reconciled across all connected nodes. This ensures that a subsequent GenServer.start_link(..., name: {:global, name}) call will not race with an identical registration on another node.

Called from HareMq.Worker.Consumer.start_link/1 before registering the consumer globally.