RockteMQ-AI commented on issue #10556: URL: https://github.com/apache/rocketmq/issues/10556#issuecomment-4828918531
**Fix Proposal (Spec v1)** **Approach:** Add a new method `findOneBrokerInCluster(String clusterName)` that uses `getBrokerClusterInfo()` (NameServer RPC `GET_BROKER_CLUSTER_INFO`) to correctly discover broker addresses by cluster name, replacing the misuse of `findOneBroker(topic)` which expects a topic name. **Changes:** 1. `ClusterMetadataService.java` — Add `findOneBrokerInCluster()` method using `mqClientAPIFactory.getClient().getBrokerClusterInfo()`, then filter by cluster name from `ClusterInfo.getClusterAddrTable()` 2. Fix 3 call sites: `ClusterUserCacheLoader`, `ClusterAclCacheLoader`, `ClusterSubscriptionGroupConfigCacheLoader` — replace `findOneBroker(clusterName)` with `findOneBrokerInCluster(clusterName)` 3. `BaseServiceTest.java` — Remove the masking mock `when(..., eq(CLUSTER_NAME))` 4. `ClusterMetadataServiceTest.java` — Add proper `getBrokerClusterInfo` mock **Risk:** Low — `getBrokerClusterInfo()` is a standard NameServer RPC, caches have TTLs so extra round-trips are minimal. `findOneBroker()` is unchanged (still used correctly by `ClusterTopicConfigCacheLoader`). Reply `/approve` to proceed with PR generation, `/revise <feedback>` to request changes, or `/reject` to decline. --- *Automated fix proposal by RockteMQ-AI* -- 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]
