merlimat commented on a change in pull request #4670: [doc] Add code samples 
for Protobuf and Avro schemas in java documentation
URL: https://github.com/apache/pulsar/pull/4670#discussion_r300155806
 
 

 ##########
 File path: site2/docs/client-libraries-java.md
 ##########
 @@ -602,6 +603,24 @@ The following schema formats are currently available for 
Java:
         .create();
   ```
 
+* Protobuf schemas can be generate using the `ProtobufSchema` class. The 
following example shows how to create the Protobuf schema and use it to 
instantiate a new producer:
+
+  ```java
+  Schema<MyProtobuf> protobufSchema = ProtobufSchema.of(MyProtobuf.class);
+  Producer<MyProtobuf> protobufProducer = client.newProducer(protobufSchema)
+        .topic("some-protobuf-topic")
+        .create();
+  ```
+
+* Avro schemas can be defined with the help of the `AvroSchema` class. The 
next code snippet demonstrates the creation and usage of the Avro schema:
+  
+  ```java
+  Schema<MyAvro> avroSchema = AvroSchema.of(MyAvro.class);
+  Producer<MyAvro> avroProducer = client.newProducer(avroSchema)
 
 Review comment:
   Same here:
   
   ```java
   client.newProducer(Schema.AVRO(MyProtobuf.class))
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to