You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/03/10 13:51:30 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #9859: pulsar-perf: add ability to create partitioned topics

eolivelli commented on a change in pull request #9859:
URL: https://github.com/apache/pulsar/pull/9859#discussion_r591528842



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java
##########
@@ -325,6 +341,31 @@ public static void main(String[] args) throws Exception {
             printAggregatedStats();
         }));
 
+        if (arguments.createTopicPartitions > 0) {
+            PulsarAdminBuilder clientBuilder = PulsarAdmin.builder()
+                    .serviceHttpUrl(arguments.adminURL)
+                    .tlsTrustCertsFilePath(arguments.tlsTrustCertsFilePath);
+
+            if (isNotBlank(arguments.authPluginClassName)) {
+                clientBuilder.authentication(arguments.authPluginClassName, arguments.authParams);
+            }
+
+            if (arguments.tlsAllowInsecureConnection != null) {
+                clientBuilder.allowTlsInsecureConnection(arguments.tlsAllowInsecureConnection);
+            }
+
+            try (PulsarAdmin client = clientBuilder.build();) {
+                for (String topic : arguments.topics) {
+                    log.info("Creating partitioned topic {} with {} partitions", topic, arguments.createTopicPartitions);
+                    try {
+                        client.topics().createPartitionedTopic(topic, arguments.createTopicPartitions);
+                    } catch (PulsarAdminException.ConflictException alreadyExists) {
+                        log.debug("Topic "+topic+" already exists: " + alreadyExists);

Review comment:
       good idea, I will add this validation




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

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