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

[GitHub] [inlong] vernedeng commented on a diff in pull request #6227: [INLONG-6226][Manager] Add a consumer group of TubeMQ for each sink

vernedeng commented on code in PR #6227:
URL: https://github.com/apache/inlong/pull/6227#discussion_r1001310721


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/queue/tubemq/TubeMQResourceOperator.java:
##########
@@ -67,23 +83,31 @@ public void createQueueForGroup(InlongGroupInfo groupInfo, String operator) {
 
         try {
             // 1. create tubemq topic
+            List<InlongStreamBriefInfo> streamInfoList = streamService.getTopicList(groupId);
+            if (CollectionUtils.isEmpty(streamInfoList)) {
+                log.warn("skip to create tubemq topic as no streams for groupId={}", groupId);
+                return;
+            }
             String clusterTag = groupInfo.getInlongClusterTag();
             TubeClusterInfo tubeCluster = (TubeClusterInfo) clusterService.getOne(clusterTag, null, ClusterType.TUBEMQ);
             String topicName = groupInfo.getMqResource();
             tubeMQOperator.createTopic(tubeCluster, topicName, operator);
             log.info("success to create tubemq topic for groupId={}", groupId);
 
             // 2. create tubemq consumer group
-            // consumer naming rules: clusterTag_topicName_consumer_group
-            String consumeGroup = clusterTag + "_" + topicName + "_consumer_group";
-            tubeMQOperator.createConsumerGroup(tubeCluster, topicName, consumeGroup, operator);
-            log.info("success to create tubemq consumer group for groupId={}", groupId);
-
-            // insert the consumer group info
-            Integer id = consumeService.saveBySystem(groupInfo, topicName, consumeGroup);
-            log.info("success to save inlong consume [{}] for consumerGroup={}, groupId={}, topic={}",
-                    id, consumeGroup, groupId, topicName);
-
+            for (InlongStreamBriefInfo stream : streamInfoList) {
+                List<StreamSink> streamSinks = sinkService.listSink(groupId, stream.getInlongStreamId());
+                for (StreamSink sink : streamSinks) {
+                    String consumeGroup = String.format(TUBEMQ_CONSUMER_GROUP, clusterTag, topicName, sink.getId());
+                    tubeMQOperator.createConsumerGroup(tubeCluster, topicName, consumeGroup, operator);
+                    log.info("success to create tubemq consumer group for groupId={}", groupId);

Review Comment:
   it's seem like consumer group for inlong stream, instead of group



-- 
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@inlong.apache.org

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