zhaohai666 opened a new issue, #10635:
URL: https://github.com/apache/rocketmq/issues/10635

   ### Before Creating the Enhancement Request
   
   - [x] I have confirmed that this should be classified as an enhancement 
rather than a bug/feature.
   
   
   ### Summary
   
   # [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:
     1. Capture a `TopicRouteSnapshot` at each polling interval
     2. Compare with the previous snapshot to detect additions, removals, and 
modifications
     3. 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
   
   - Depends on PR #1 (proto definition for WatchRouteChange RPC)
   - Can be developed in parallel with PR #3 (security)
   
   ## 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`
   
   
   ### Motivation
   
   # [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:
     1. Capture a `TopicRouteSnapshot` at each polling interval
     2. Compare with the previous snapshot to detect additions, removals, and 
modifications
     3. 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
   
   - Depends on PR #1 (proto definition for WatchRouteChange RPC)
   - Can be developed in parallel with PR #3 (security)
   
   ## 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`
   
   
   ### Describe the Solution You'd Like
   
   # [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:
     1. Capture a `TopicRouteSnapshot` at each polling interval
     2. Compare with the previous snapshot to detect additions, removals, and 
modifications
     3. 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
   
   - Depends on PR #1 (proto definition for WatchRouteChange RPC)
   - Can be developed in parallel with PR #3 (security)
   
   ## 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`
   
   
   ### Describe Alternatives You've Considered
   
   # [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:
     1. Capture a `TopicRouteSnapshot` at each polling interval
     2. Compare with the previous snapshot to detect additions, removals, and 
modifications
     3. 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
   
   - Depends on PR #1 (proto definition for WatchRouteChange RPC)
   - Can be developed in parallel with PR #3 (security)
   
   ## 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`
   
   
   ### Additional Context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to