Skip to content

add presence feed to cluster mode via broadcast to all nodes - #138

Merged
fabracht merged 2 commits into
mainfrom
presence-feed-cluster
Sep 20, 2026
Merged

fabracht merged 2 commits into
mainfrom
presence-feed-cluster

Conversation

@fabracht

Copy link
Copy Markdown
Contributor

Summary

Cluster-mode presence feed, behind the same opt-in --presence / MQDB_PRESENCE flag as agent mode.

  • each node publishes retained presence for its own clients to $DB/_presence/{client_id} and broadcasts it to every other node, which publishes it locally
  • cross-node delivery uses a broadcast rather than publish routing because TopicTrie::match_topic returns nothing for $-prefixed topics, so a $DB/_presence/# subscriber can never resolve as a remote target
  • _presence is added to the $DB/ pass-through list so the message reaches subscribers instead of being taken for a database operation
  • live connections are tracked per client id so a session takeover does not report a still-connected client as disconnected
  • adds mqdb dev test --presence covering same-node, cross-node both directions, retained state for a late janitor on another node, and a rejected forgery

Every node ends up holding the retained set, so a janitor sees current state from whichever node it attaches to.

Test plan

  • cargo make format-check clean
  • cargo make clippy passes with zero warnings
  • cargo make test: 24 suites, 1196 passed, 0 failed
  • cluster unit tests: local publish plus broadcast, internal-client and takeover suppression, received broadcast published locally
  • live 3-node cluster mqdb dev test --presence: 7 passed, 0 failed

@fabracht
fabracht merged commit f69fed6 into main Sep 20, 2026
9 checks passed
@fabracht
fabracht deleted the presence-feed-cluster branch September 20, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant