feat: cluster mode with leader election & WebSocket worker mesh#59
Merged
feat: cluster mode with leader election & WebSocket worker mesh#59
Conversation
Adds FlowcoreDataPumpCluster for HA failover and horizontal scaling of event processing. Leader fetches events and distributes to workers via persistent WebSocket connections. Uses abstract coordinator interface (user-implemented against their DB) for lease-based leader election and instance discovery. Falls back to local processing when no workers available. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace Deno-specific Deno.serve/upgradeWebSocket with a public handleConnection(ws: WebSocket) method. Users wire up their own HTTP server and call handleConnection on upgrade. Works with both Deno and Node.js (via ws package). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FlowcoreDataPumpClusterclass for HA failover and horizontal scaling of event processing across multiple instancesFlowcoreDataPumpCoordinatorinterface (user implements against their DB, same pattern asstateManager)FlowcoreDataPump, distributes to workers over persistent WebSocket connectionsFlowcoreDataPumpclass -- cluster wraps itNew files
src/data-pump/types.ts-FlowcoreDataPumpCoordinatorinterfacesrc/data-pump/ws-protocol.ts- WS message types, serialization,WsConnection,DeliveryTrackersrc/data-pump/data-pump-cluster.ts-FlowcoreDataPumpClusterclasssrc/data-pump/metrics.ts- cluster metrics (active workers, leader status, distribution counters)test/tests/data-pump-cluster.test.ts- tests for WS protocol, DeliveryTracker, MockCoordinatorTest plan
deno test)🤖 Generated with Claude Code