You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/12/22 10:38:58 UTC

[GitHub] [rocketmq] aaron-ai commented on a diff in pull request #5755: [ISSUE #5754] [RIP-57] Add asynchronous interfaces to MessageStore

aaron-ai commented on code in PR #5755:
URL: https://github.com/apache/rocketmq/pull/5755#discussion_r1055325703


##########
broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:
##########
@@ -283,6 +282,28 @@ public MessageExt getMessage(String topic, long offset, int queueId, String brok
         }
     }
 
+    public CompletableFuture<MessageExt> getMessageAsync(String topic, long offset, int queueId, String brokerName, boolean deCompressBody) {
+        MessageStore messageStore = brokerController.getMessageStoreByBrokerName(brokerName);
+        if (messageStore != null) {
+            return messageStore.getMessageAsync(innerConsumerGroupName, topic, queueId, offset, 1, null)
+                .thenApply(result -> {
+                    if (result == null) {
+                        LOG.warn("getMessageResult is null , innerConsumerGroupName {}, topic {}, offset {}, queueId {}", innerConsumerGroupName, topic, offset, queueId);
+                        return null;
+                    }
+                    List<MessageExt> list = decodeMsgList(result, deCompressBody);
+                    if (list == null || list.isEmpty()) {
+                        LOG.warn("Can not get msg , topic {}, offset {}, queueId {}, result is {}", topic, offset, queueId, result);
+                        return null;
+                    } else {
+                        return list.get(0);

Review Comment:
   redundant else



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org