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/05 08:38:24 UTC

[GitHub] [rocketmq] drpmma commented on a diff in pull request #5611: [ISSUE #5568] Support long length group and topic for pop mode consumption

drpmma commented on code in PR #5611:
URL: https://github.com/apache/rocketmq/pull/5611#discussion_r1039296828


##########
broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:
##########
@@ -586,9 +587,35 @@ private long popMsgFromQueue(boolean isRetry, GetMessageResult getMessageResult,
         } finally {
             queueLockManager.unLock(lockKey);
         }
+
         if (getMessageTmpResult != null) {
+            String brokerName = brokerController.getBrokerConfig().getBrokerName();
             for (SelectMappedBufferResult mapedBuffer : getMessageTmpResult.getMessageMapedList()) {
-                getMessageResult.addMessage(mapedBuffer);
+                // We should not recode buffer for normal topic message
+                if (!isRetry) {
+                    getMessageResult.addMessage(mapedBuffer);
+                } else {
+                    List<MessageExt> messageExtList = MessageDecoder.decodesBatch(mapedBuffer.getByteBuffer(),
+                        true, false, true);
+                    mapedBuffer.release();
+                    for (MessageExt messageExt : messageExtList) {
+                        try {
+                            String ckInfo = ExtraInfoUtil.buildExtraInfo(offset, popTime, requestHeader.getInvisibleTime(),
+                                reviveQid, messageExt.getTopic(), brokerName, messageExt.getQueueId(), messageExt.getQueueOffset());
+                            messageExt.getProperties().putIfAbsent(MessageConst.PROPERTY_POP_CK, ckInfo);
+                            messageExt.setTopic(requestHeader.getTopic());

Review Comment:
   It's recommended to add some annotations about replacing the message retry topic with its original topic.



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