lizhimins commented on code in PR #6724:
URL: https://github.com/apache/rocketmq/pull/6724#discussion_r1226383863


##########
broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:
##########
@@ -138,6 +144,63 @@ public RemotingCommand heartBeat(ChannelHandlerContext 
ctx, RemotingCommand requ
         }
         response.setCode(ResponseCode.SUCCESS);
         response.setRemark(null);
+        response.addExtField(MixAll.IS_SUPPORT_HEART_BEAT_V2, 
Boolean.TRUE.toString());
+        response.addExtField(MixAll.IS_SUB_CHANGE, Boolean.TRUE.toString());
+        return response;
+    }
+
+    private RemotingCommand heartBeatV2(ChannelHandlerContext ctx, 
HeartbeatData heartbeatData, ClientChannelInfo clientChannelInfo, 
RemotingCommand response) {
+        boolean isSubChange = false;
+        for (ConsumerData consumerData : heartbeatData.getConsumerDataSet()) {
+            //Reject the PullConsumer
+            if 
(brokerController.getBrokerConfig().isRejectPullConsumerEnable()) {
+                if (ConsumeType.CONSUME_ACTIVELY == 
consumerData.getConsumeType()) {
+                    continue;
+                }
+            }
+            if (null != 
consumerGroupHeartbeatTable.get(consumerData.getGroupName()) && 
consumerGroupHeartbeatTable.get(consumerData.getGroupName()) != 
heartbeatData.getHeartbeatFingerprint()) {
+                isSubChange = true;
+            }
+            consumerGroupHeartbeatTable.put(consumerData.getGroupName(), 
heartbeatData.getHeartbeatFingerprint());
+            boolean hasOrderTopicSub = false;
+
+            for (final SubscriptionData subscriptionData : 
consumerData.getSubscriptionDataSet()) {
+                if 
(this.brokerController.getTopicConfigManager().isOrderTopic(subscriptionData.getTopic()))
 {
+                    hasOrderTopicSub = true;
+                    break;
+                }
+            }
+            SubscriptionGroupConfig subscriptionGroupConfig = 
this.brokerController.getSubscriptionGroupManager().findSubscriptionGroupConfig(consumerData.getGroupName());
+            boolean isNotifyConsumerIdsChangedEnable = true;
+            if (null == subscriptionGroupConfig) {
+                continue;
+            }
+            isNotifyConsumerIdsChangedEnable = 
subscriptionGroupConfig.isNotifyConsumerIdsChangedEnable();
+            int topicSysFlag = 0;
+            if (consumerData.isUnitMode()) {
+                topicSysFlag = TopicSysFlag.buildSysFlag(false, true);
+            }
+            String newTopic = 
MixAll.getRetryTopic(consumerData.getGroupName());
+            
this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(newTopic,
 subscriptionGroupConfig.getRetryQueueNums(), PermName.PERM_WRITE | 
PermName.PERM_READ, hasOrderTopicSub, topicSysFlag);
+            boolean changed = false;
+            if (heartbeatData.isWithoutSub()) {
+                changed = 
this.brokerController.getConsumerManager().registerConsumerWithoutSub(consumerData.getGroupName(),
 clientChannelInfo, consumerData.getConsumeType(), 
consumerData.getMessageModel(), consumerData.getConsumeFromWhere(), 
isNotifyConsumerIdsChangedEnable);

Review Comment:
   Same as before



##########
broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:
##########
@@ -138,6 +144,63 @@ public RemotingCommand heartBeat(ChannelHandlerContext 
ctx, RemotingCommand requ
         }
         response.setCode(ResponseCode.SUCCESS);
         response.setRemark(null);
+        response.addExtField(MixAll.IS_SUPPORT_HEART_BEAT_V2, 
Boolean.TRUE.toString());
+        response.addExtField(MixAll.IS_SUB_CHANGE, Boolean.TRUE.toString());
+        return response;
+    }
+
+    private RemotingCommand heartBeatV2(ChannelHandlerContext ctx, 
HeartbeatData heartbeatData, ClientChannelInfo clientChannelInfo, 
RemotingCommand response) {
+        boolean isSubChange = false;
+        for (ConsumerData consumerData : heartbeatData.getConsumerDataSet()) {
+            //Reject the PullConsumer
+            if 
(brokerController.getBrokerConfig().isRejectPullConsumerEnable()) {
+                if (ConsumeType.CONSUME_ACTIVELY == 
consumerData.getConsumeType()) {
+                    continue;
+                }
+            }
+            if (null != 
consumerGroupHeartbeatTable.get(consumerData.getGroupName()) && 
consumerGroupHeartbeatTable.get(consumerData.getGroupName()) != 
heartbeatData.getHeartbeatFingerprint()) {

Review Comment:
   Suggest line breaks for better codestyle



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