rvashishth opened a new issue #9602:
URL: https://github.com/apache/pulsar/issues/9602


   **Describe the bug**
   Unable to add AVRO schema on a topic using producer client. 
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. create a topic
   2. produce a message with json schema
   
   ```
   Producer<User> producer = 
client.newProducer(Schema.JSON(User.class)).topic(Commons.TOPIC).create();
         User user = new User("rahul",31);
         MessageId msgId = producer.send(user);
   ```
   3. get schema api - return json schema type
   
   ```
   {
       "getSchemaResponses": [
           {
               "version": 0,
               "type": "JSON",
               "timestamp": 0,
               "data": 
"{\"type\":\"record\",\"name\":\"User\",\"namespace\":\"com.optum.link.pulsar\",\"fields\":[{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"age\",\"type\":\"int\"}]}",
               "properties": {
                   "__jsr310ConversionEnabled": "false",
                   "__alwaysAllowNull": "true"
               }
           }
       ]
   }
   ```
   
   4. produce 2nd message with avro schema
   ```
   Producer<User> producer = 
client.newProducer(Schema.AVRO(User.class)).topic(Commons.TOPIC).create();
         User user = new User("josh",31);
         MessageId msgId = producer.send(user);
   ```
   
   5. get schema api - returns only previously created json schema object. it 
did not include AVRO schema
   ```
   {
       "getSchemaResponses": [
           {
               "version": 0,
               "type": "JSON",
               "timestamp": 0,
               "data": 
"{\"type\":\"record\",\"name\":\"User\",\"namespace\":\"com.optum.link.pulsar\",\"fields\":[{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"age\",\"type\":\"int\"}]}",
               "properties": {
                   "__jsr310ConversionEnabled": "false",
                   "__alwaysAllowNull": "true"
               }
           }
       ]
   }
   ```
   
   **Expected behavior**
   Avro schema should be added pulsar schema registry, or if this is not 
feasible then producer client should throw error
   
   **Screenshots**
   NA
   
   **Desktop (please complete the following information):**
    - OS:  iOS
    - Pulsar: 2.7.0
    - Pulsar Client: 2.7.0
   
   **Additional context**
   I could successfully produce/consume messages using json schema.
   


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


Reply via email to