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/06/01 09:00:00 UTC

[GitHub] [incubator-inlong] xuesongxs opened a new pull request, #4479: [INLONG-4468][Manager] Use config url to create pulsar admin instead of use pulsar dns

xuesongxs opened a new pull request, #4479:
URL: https://github.com/apache/incubator-inlong/pull/4479

   - Fixes #4468
   


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


[GitHub] [incubator-inlong] dockerzhang merged pull request #4479: [INLONG-4468][Manager] Use the user-configured URL instead of the DNS of Pulsar

Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #4479:
URL: https://github.com/apache/incubator-inlong/pull/4479


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


[GitHub] [incubator-inlong] xuesongxs commented on pull request #4479: [INLONG-4468][Manager] Use config url to create pulsar admin instead of use pulsar dns

Posted by GitBox <gi...@apache.org>.
xuesongxs commented on PR #4479:
URL: https://github.com/apache/incubator-inlong/pull/4479#issuecomment-1143330680

   @dockerzhang please review.


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


[GitHub] [incubator-inlong] healchow commented on a diff in pull request #4479: [INLONG-4468][Manager] Use config url to create pulsar admin instead of use pulsar dns

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4479:
URL: https://github.com/apache/incubator-inlong/pull/4479#discussion_r887439823


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/mq/CreatePulsarSubscriptionTaskListener.java:
##########
@@ -87,28 +88,29 @@ public ListenerResult listen(WorkflowContext context) throws WorkflowListenerExc
             topicBean.setTenant(tenant);
             topicBean.setNamespace(namespace);
             topicBean.setTopicName(topic);
-            List<String> pulsarClusters = PulsarUtils.getPulsarClusters(globalPulsarAdmin);
 
-            // Create a subscription in the Pulsar cluster (cross-region), you need to ensure that the Topic exists
-            for (String cluster : pulsarClusters) {
-                String serviceUrl = PulsarUtils.getServiceUrl(globalPulsarAdmin, cluster);
-                PulsarClusterInfo pulsarClusterInfo = PulsarClusterInfo.builder()
-                        .token(globalCluster.getToken()).adminUrl(serviceUrl).build();
-                try (PulsarAdmin pulsarAdmin = PulsarUtils.getPulsarAdmin(pulsarClusterInfo)) {
-                    boolean exist = pulsarOptService.topicIsExists(pulsarAdmin, tenant, namespace, topic);
-                    if (!exist) {
-                        String fullTopic = tenant + "/" + namespace + "/" + topic;
-                        log.error("topic={} not exists in {}", fullTopic, pulsarAdmin.getServiceUrl());
-                        throw new BusinessException("topic=" + fullTopic + " not exists in " + serviceUrl);
-                    }
+            // Create a subscription in the Pulsar cluster, you need to ensure that the Topic exists
+            try {
+                boolean exist = pulsarOptService.topicIsExists(pulsarAdmin, tenant, namespace, topic);
+                if (!exist) {
+                    String fullTopic = tenant + "/" + namespace + "/" + topic;
+                    String serviceUrl = pulsarClusterInfo.getAdminUrl();
+                    log.error("topic={} not exists in {}", fullTopic, serviceUrl);
+                    throw new BusinessException("topic=" + fullTopic + " not exists in " + serviceUrl);
+                }
 
-                    // Consumer naming rules: sortAppName_topicName_consumer_group
-                    String subscription = clusterBean.getAppName() + "_" + topic + "_consumer_group";
-                    pulsarOptService.createSubscription(pulsarAdmin, topicBean, subscription);
+                // Consumer naming rules: sortAppName_topicName_consumer_group
+                String subscription = clusterBean.getAppName() + "_" + topic + "_consumer_group";
+                pulsarOptService.createSubscription(pulsarAdmin, topicBean, subscription);
 
-                    // Insert the consumption data into the consumption table
-                    consumptionService.saveSortConsumption(groupInfo, topic, subscription);
-                }
+                // Insert the consumption data into the consumption table
+                consumptionService.saveSortConsumption(groupInfo, topic, subscription);
+            } catch (PulsarAdminException e) {

Review Comment:
   The `PulsarAdminException` and `PulsarAdminException` can write in one line as follows:
   
   ```
   catch (PulsarAdminException | BusinessException e)
   ```



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


[GitHub] [incubator-inlong] dockerzhang commented on a diff in pull request #4479: [INLONG-4468][Manager] Use config url to create pulsar admin instead of use pulsar dns

Posted by GitBox <gi...@apache.org>.
dockerzhang commented on code in PR #4479:
URL: https://github.com/apache/incubator-inlong/pull/4479#discussion_r886679476


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/mq/CreatePulsarGroupTaskListener.java:
##########
@@ -94,29 +95,29 @@ public ListenerResult listen(WorkflowContext context) throws WorkflowListenerExc
                 topicBean.setNamespace(namespace);
                 String topic = streamEntity.getMqResource();
                 topicBean.setTopicName(topic);
-                List<String> pulsarClusters = PulsarUtils.getPulsarClusters(globalPulsarAdmin);
-
-                // Create a subscription in the Pulsar cluster (cross-region), you need to ensure that the Topic exists
-                for (String cluster : pulsarClusters) {
-                    String serviceUrl = PulsarUtils.getServiceUrl(globalPulsarAdmin, cluster);
-                    PulsarClusterInfo pulsarClusterInfo = PulsarClusterInfo.builder()
-                            .token(globalCluster.getToken()).adminUrl(serviceUrl).build();
-                    try (PulsarAdmin pulsarAdmin = PulsarUtils.getPulsarAdmin(pulsarClusterInfo)) {
-                        boolean exist = pulsarOptService.topicIsExists(pulsarAdmin, tenant, namespace, topic);
-
-                        if (!exist) {
-                            String topicFull = tenant + "/" + namespace + "/" + topic;
-                            log.error("topic={} not exists in {}", topicFull, serviceUrl);
-                            throw new WorkflowListenerException("topic=" + topicFull + " not exists in " + serviceUrl);
-                        }
-
-                        // Consumer naming rules: sortAppName_topicName_consumer_group
-                        String subscription = clusterBean.getAppName() + "_" + topic + "_consumer_group";
-                        pulsarOptService.createSubscription(pulsarAdmin, topicBean, subscription);
-
-                        // Insert the consumption data into the consumption table
-                        consumptionService.saveSortConsumption(groupInfo, topic, subscription);
+
+                // Create a subscription in the Pulsar cluster you need to ensure that the Topic exists
+                try {
+                    boolean exist = pulsarOptService.topicIsExists(globalPulsarAdmin, tenant, namespace, topic);

Review Comment:
   if we remove the multi clusters, I think we should remove all `global` prefixes for all params.



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