[studio] feat: Route Change Event Detection and Notification System
Background
This is the fourth atomic PR in the RIP-2 (Proxy Admin Interface) series. It implements a real-time route change monitoring system that enables admin clients to subscribe to topic routing changes via server-streaming gRPC.
Design Proposal
Event Detection
- RouteChangeEventDetector: Periodically polls the TopicRouteService for route state changes. Uses a snapshot-diffing approach:
- Capture a
TopicRouteSnapshot at each polling interval
- Compare with the previous snapshot to detect additions, removals, and modifications
- Emit
RouteChangeEvent objects for each detected change
Event Notification
- RouteChangeNotifier: Manages subscriber lifecycle and event dispatch:
- Subscribers register via the
WatchRouteChange streaming RPC
- Events are dispatched asynchronously to all active subscribers
- Supports topic-level filtering (subscribe to specific topics or all)
- Handles subscriber disconnection gracefully with cleanup
Data Models
- RouteChangeEvent: Immutable event object containing event type, topic name, timestamp, and before/after route data
- RouteChangeEventType: Enum —
TOPIC_ADDED, TOPIC_REMOVED, ROUTE_CHANGED, BROKER_CHANGED
- TopicRouteSnapshot: Point-in-time capture of all topic routes, used for diffing
Integration with TopicRouteService
- Modified
TopicRouteService to expose a change signal (version counter) that the detector can poll efficiently without full route table comparison
Scope
| File |
Type |
Description |
RouteChangeEventDetector.java |
New |
Change detection engine |
RouteChangeNotifier.java |
New |
Subscriber management and dispatch |
RouteChangeEvent.java |
New |
Event data model |
RouteChangeEventType.java |
New |
Event type enumeration |
TopicRouteSnapshot.java |
New |
Route state snapshot |
TopicRouteService.java |
Modified |
Change signal exposure |
RouteChangeEventDetectorTest.java |
New |
Detector tests (610 lines) |
RouteChangeNotifierTest.java |
New |
Notifier tests (531 lines) |
RouteChangeEventTest.java |
New |
Event model tests |
TopicRouteSnapshotTest.java |
New |
Snapshot tests |
Total: 10 files, +2414 lines
Dependencies
Testing
- Detector tests: single change, batch changes, no-change polling, concurrent modifications
- Notifier tests: subscriber add/remove, event dispatch, filtering, disconnection cleanup
- Model tests: immutability, equality, serialization
Branch
feature/rip-2-pr4-route-change-event
[studio] feat: Route Change Event Detection and Notification System
Background
This is the fourth atomic PR in the RIP-2 (Proxy Admin Interface) series. It implements a real-time route change monitoring system that enables admin clients to subscribe to topic routing changes via server-streaming gRPC.
Design Proposal
Event Detection
TopicRouteSnapshotat each polling intervalRouteChangeEventobjects for each detected changeEvent Notification
WatchRouteChangestreaming RPCData Models
TOPIC_ADDED,TOPIC_REMOVED,ROUTE_CHANGED,BROKER_CHANGEDIntegration with TopicRouteService
TopicRouteServiceto expose a change signal (version counter) that the detector can poll efficiently without full route table comparisonScope
RouteChangeEventDetector.javaRouteChangeNotifier.javaRouteChangeEvent.javaRouteChangeEventType.javaTopicRouteSnapshot.javaTopicRouteService.javaRouteChangeEventDetectorTest.javaRouteChangeNotifierTest.javaRouteChangeEventTest.javaTopicRouteSnapshotTest.javaTotal: 10 files, +2414 lines
Dependencies
Testing
Branch
feature/rip-2-pr4-route-change-event