merlimat commented on a change in pull request #1535: Issue #1536: Introduce 
Short Topic Name
URL: https://github.com/apache/incubator-pulsar/pull/1535#discussion_r181197109
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
 ##########
 @@ -240,6 +242,22 @@ void start() throws Exception {
             log.info(e.getMessage());
         }
 
+        // Create a public tenant and default namespace
+        final String publicTenant = TopicName.PUBLIC_PROPERTY;
+        final String defaultNamespace = TopicName.PUBLIC_PROPERTY + "/" + 
TopicName.DEFAULT_NAMESPACE;
+        try {
+            if (!admin.properties().getProperties().contains(publicTenant)) {
+                admin.properties().createProperty(
+                    publicTenant,
+                    new 
PropertyAdmin(Sets.newHashSet(config.getSuperUserRoles()), 
Sets.newHashSet(cluster)));
+            }
+            if 
(!admin.namespaces().getNamespaces(publicTenant).contains(defaultNamespace)) {
+                admin.namespaces().createNamespace(defaultNamespace);
 
 Review comment:
   For v2, we need to specify the "replication" cluster. I added a convenience 
method in #1562, though you can just add : 
   ```java
   admin.namespaces().setNamespaceReplicationClusters(defaultNamespace, 
Sets.newHashSet(config.getClusterName());
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to