Denovo1998 commented on code in PR #17449:
URL: https://github.com/apache/pulsar/pull/17449#discussion_r1092903518


##########
pulsar-common/src/main/java/org/apache/pulsar/common/protocol/Commands.java:
##########
@@ -801,6 +805,20 @@ private static void convertSchema(SchemaInfo schemaInfo, 
Schema schema) {
         });
     }
 
+    private static void convertAutoConsumeSchema(SchemaInfo schemaInfo, Schema 
schema) {
+        schema.setName(schemaInfo.getName())
+                .setSchemaData(schemaInfo.getSchema())
+                .setType(Schema.Type.AutoConsume);

Review Comment:
   
https://github.com/apache/pulsar/blob/fa6af432ef3d015b371121afd9324ba7f393994d/pulsar-client-api/src/main/java/org/apache/pulsar/common/schema/SchemaType.java#L178-L180
   If we change the value of `AUTO_CONSUME` in `SchemaType` to 21, the behavior 
may change in two places: 
   
https://github.com/apache/pulsar/blob/fa6af432ef3d015b371121afd9324ba7f393994d/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java#L758-L761
   
https://github.com/apache/pulsar/blob/fa6af432ef3d015b371121afd9324ba7f393994d/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java#L613-L619
   
   So how about we make that change
   ```java
       private static void convertAutoConsumeSchema(SchemaInfo schemaInfo, 
Schema schema) {
           convertSchema(schemaInfo, schema);
           schema.setType(Schema.Type.AutoConsume);
       }
   ```
   And in `ServerCnx`.
   ```java
               .type(protocolSchema.getType() == Schema.Type.AutoConsume
                       ? SchemaType.AUTO_CONSUME : 
Commands.getSchemaType(protocolSchema.getType()))
   ```
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to