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 2022/02/09 03:43:28 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #14102: [#14101] [schema] making schema registry configurable

codelipenghui commented on a change in pull request #14102:
URL: https://github.com/apache/pulsar/pull/14102#discussion_r802245094



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryService.java
##########
@@ -42,19 +44,29 @@
         return checkers;
     }
 
-    static SchemaRegistryService create(SchemaStorage schemaStorage, Set<String> schemaRegistryCompatibilityCheckers) {
+    static SchemaRegistryService create(String schemaRegistryName, SchemaStorage schemaStorage,
+          Set<String> schemaRegistryCompatibilityCheckers) {
         if (schemaStorage != null) {
             try {
                 Map<SchemaType, SchemaCompatibilityCheck> checkers = getCheckers(schemaRegistryCompatibilityCheckers);
                 checkers.put(SchemaType.KEY_VALUE, new KeyValueSchemaCompatibilityCheck(checkers));
-                return SchemaRegistryServiceWithSchemaDataValidator.of(
-                        new SchemaRegistryServiceImpl(schemaStorage, checkers));
+
+                if (schemaRegistryName == null) {
+                return SchemaRegistryServiceWithSchemaDataValidator
+                      .of(new SchemaRegistryServiceImpl(schemaStorage, checkers));

Review comment:
       Correct the code format there.

##########
File path: conf/standalone.conf
##########
@@ -180,6 +180,8 @@ maxTopicsPerNamespace=0
 # 'is_allow_auto_update_schema' of namespace policy.
 isAllowAutoUpdateSchemaEnabled=true
 
+schemaRegistryClass=

Review comment:
       It's better to have a description, by default pulsar will use the internal schema registry which is based on the bookkeeper.

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryService.java
##########
@@ -42,19 +44,29 @@
         return checkers;
     }
 
-    static SchemaRegistryService create(SchemaStorage schemaStorage, Set<String> schemaRegistryCompatibilityCheckers) {
+    static SchemaRegistryService create(String schemaRegistryName, SchemaStorage schemaStorage,

Review comment:
       ```suggestion
       static SchemaRegistryService create(String schemaRegistryClassName, SchemaStorage schemaStorage,
   ```

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryService.java
##########
@@ -42,19 +44,29 @@
         return checkers;
     }
 
-    static SchemaRegistryService create(SchemaStorage schemaStorage, Set<String> schemaRegistryCompatibilityCheckers) {
+    static SchemaRegistryService create(String schemaRegistryName, SchemaStorage schemaStorage,
+          Set<String> schemaRegistryCompatibilityCheckers) {
         if (schemaStorage != null) {
             try {
                 Map<SchemaType, SchemaCompatibilityCheck> checkers = getCheckers(schemaRegistryCompatibilityCheckers);
                 checkers.put(SchemaType.KEY_VALUE, new KeyValueSchemaCompatibilityCheck(checkers));
-                return SchemaRegistryServiceWithSchemaDataValidator.of(
-                        new SchemaRegistryServiceImpl(schemaStorage, checkers));
+
+                if (schemaRegistryName == null) {
+                return SchemaRegistryServiceWithSchemaDataValidator
+                      .of(new SchemaRegistryServiceImpl(schemaStorage, checkers));
+                } else {
+                    return (SchemaRegistryService) Class.forName(schemaRegistryName)

Review comment:
       Better to have a unit test to make sure the configuration works well.




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

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