RockteMQ-AI commented on code in PR #1360:
URL: https://github.com/apache/rocketmq-clients/pull/1360#discussion_r3923642991


##########
rust/src/model/message.rs:
##########
@@ -432,6 +432,8 @@ pub trait AckMessageEntry {
     fn message_id(&self) -> String;
     fn receipt_handle(&self) -> String;
     fn endpoints(&self) -> &Endpoints;
+    /// Lite topic of the message, if it is a lite message.

Review Comment:
   **[Info]** Adding `lite_topic()` to the `AckMessageEntry` trait is a 
breaking change for any external implementors. Since this trait is `pub`, 
consider adding a default implementation (`fn lite_topic(&self) -> 
Option<String> { None }`) to preserve backward compatibility for downstream 
users who implement this trait.



##########
rust/src/util.rs:
##########
@@ -55,6 +55,35 @@ pub(crate) fn select_message_queue_by_message_group(
     route.queue[index as usize].clone()
 }
 
+const MASTER_BROKER_ID: i32 = 0;
+
+/// Select the first readable master queue for lite consumers.
+///
+/// Reference Java: LiteSimpleConsumerImpl.updateSubscriptionLoadBalancer
+///   -> SubscriptionLoadBalancer::isReadableMasterQueue
+pub(crate) fn select_first_readable_queue(route: &Route) -> 
Result<MessageQueue, ClientError> {
+    route
+        .queue
+        .iter()
+        .find(|queue| {

Review Comment:
   **[Info]** `is_some_and` requires Rust 1.70+. Please verify this aligns with 
the project MSRV. If the MSRV is lower, consider using `.map_or(false, |broker| 
broker.id == MASTER_BROKER_ID)` instead.



-- 
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