Skip to content

VOIP-1276-Replace-api-manager-zmq-with-pure-go-pubsub - #1150

Merged
pchero merged 1 commit into
mainfrom
VOIP-1276-Replace-api-manager-zmq-with-pure-go-pubsub
Jul 31, 2026
Merged

VOIP-1276-Replace-api-manager-zmq-with-pure-go-pubsub#1150
pchero merged 1 commit into
mainfrom
VOIP-1276-Replace-api-manager-zmq-with-pure-go-pubsub

Conversation

@pchero

@pchero pchero commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Replace bin-api-manager's internal ZeroMQ (pebbe/zmq4, cgo) pub/sub with a pure Go in-process broker. The only ZeroMQ transport in use was inproc://api-manager (pod-local fan-out of RabbitMQ events to WebSocket subscribers), so the cgo/libzmq dependency bought nothing. The replacement preserves the full behavioral contract (topic prefix matching, deliver-once on overlapping prefixes, drop-on-full slow-subscriber isolation with a new drop counter metric, buffer 2000 matching the previous effective HWM) and fixes latent data races from concurrent use of non-thread-safe libzmq sockets, plus removes the 1-second receive polling latency. Jira: VOIP-1276.

  • bin-api-manager: Add pkg/pubsubhandler, a pure Go in-process pub/sub broker (BrokerHandler/PubHandler/SubHandler) with -race-verified unit tests
  • bin-api-manager: Race-free shutdown design (data channel never closed; Terminate unregisters under broker write lock then signals done)
  • bin-api-manager: Wire the broker via constructor injection in cmd/api-manager/main.go into subscribehandler and websockhandler
  • bin-api-manager: Remove pkg/zmq, pkg/zmqpubhandler, pkg/zmqsubhandler and drop pebbe/zmq4 from go.mod
  • bin-api-manager: Remove libzmq install steps from Dockerfile, README, CLAUDE.md and service docs; document new api_manager_pubsub_dropped_message_total metric in operations.md
  • bin-api-manager: Update docsdev RST architecture pages (ZeroMQ section replaced with accurate in-process fan-out description) and rebuild Sphinx HTML
  • bin-api-manager: Add design document docs/plans/2026-07-31-api-manager-pubsub-replacement-design.md
  • monorepo: Remove libzmq install step from CircleCI config and development guide
  • monorepo: Update root CLAUDE.md event-driven architecture description

- bin-api-manager: Add pkg/pubsubhandler, a pure Go in-process pub/sub broker replacing ZeroMQ
- bin-api-manager: Preserve ZMQ behavioral contract (prefix matching, deliver-once, drop-on-full with metric, buffer 2000)
- bin-api-manager: Race-free shutdown design (never-closed data channel + done signal, unregister under write lock)
- bin-api-manager: Wire broker via constructor injection in cmd/api-manager/main.go, subscribehandler, websockhandler
- bin-api-manager: Remove pkg/zmq, pkg/zmqpubhandler, pkg/zmqsubhandler and pebbe/zmq4 cgo dependency
- bin-api-manager: Remove libzmq install steps from Dockerfile, README, CLAUDE.md, docs
- bin-api-manager: Add design document docs/plans/2026-07-31-api-manager-pubsub-replacement-design.md
- monorepo: Remove libzmq install step from CircleCI config and development guide
- monorepo: Update root CLAUDE.md event-driven architecture description
@pchero
pchero force-pushed the VOIP-1276-Replace-api-manager-zmq-with-pure-go-pubsub branch from fa476b9 to 43e3b75 Compare July 31, 2026 00:14
@pchero
pchero merged commit 6235610 into main Jul 31, 2026
2 of 3 checks passed
@pchero
pchero deleted the VOIP-1276-Replace-api-manager-zmq-with-pure-go-pubsub branch July 31, 2026 00:21
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