Skip to content

Commit b4fe6a0

Browse files
authored
[ISSUE #2556]🚀Implement DefaultMQAdminExt examine_topic_route_info method🔥 (#2557)
1 parent 38ff8ad commit b4fe6a0

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

rocketmq-client/src/admin/default_mq_admin_ext_impl.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,15 @@ impl MQAdminExt for DefaultMQAdminExtImpl {
348348
async fn examine_topic_route_info(
349349
&self,
350350
topic: CheetahString,
351-
) -> crate::Result<TopicRouteData> {
352-
todo!()
351+
) -> crate::Result<Option<TopicRouteData>> {
352+
self.client_instance
353+
.as_ref()
354+
.unwrap()
355+
.mq_client_api_impl
356+
.as_ref()
357+
.unwrap()
358+
.get_topic_route_info_from_name_server(&topic, self.timeout_millis.as_millis() as u64)
359+
.await
353360
}
354361

355362
async fn examine_consumer_connection_info(

rocketmq-client/src/admin/mq_admin_ext_async.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ pub trait MQAdminExtLocal: Sync {
159159

160160
async fn examine_broker_cluster_info(&self) -> Result<ClusterInfo>;
161161

162-
async fn examine_topic_route_info(&self, topic: CheetahString) -> Result<TopicRouteData>;
162+
async fn examine_topic_route_info(
163+
&self,
164+
topic: CheetahString,
165+
) -> Result<Option<TopicRouteData>>;
163166

164167
async fn examine_consumer_connection_info(
165168
&self,

rocketmq-example/examples/consumer/pop_consumer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ async fn switch_pop_consumer() -> Result<()> {
6868
let broker_datas =
6969
MQAdminExt::examine_topic_route_info(&mq_admin_ext, CheetahString::from_static_str(TOPIC))
7070
.await
71+
.unwrap()
7172
.unwrap();
7273
for broker_data in broker_datas.broker_datas {
7374
let broker_addrs = broker_data
@@ -90,6 +91,7 @@ async fn switch_pop_consumer() -> Result<()> {
9091
.unwrap();
9192
}
9293
}
94+
mq_admin_ext.shutdown().await;
9395
Ok(())
9496
}
9597

rocketmq-tools/src/admin/default_mq_admin_ext.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ impl MQAdminExt for DefaultMQAdminExt {
366366
async fn examine_topic_route_info(
367367
&self,
368368
topic: CheetahString,
369-
) -> rocketmq_client_rust::Result<TopicRouteData> {
370-
todo!()
369+
) -> rocketmq_client_rust::Result<Option<TopicRouteData>> {
370+
self.default_mqadmin_ext_impl
371+
.examine_topic_route_info(topic)
372+
.await
371373
}
372374

373375
async fn examine_consumer_connection_info(

0 commit comments

Comments
 (0)