Anonymitaet commented on a change in pull request #12496:
URL: https://github.com/apache/pulsar/pull/12496#discussion_r738897586



##########
File path: site2/docs/schema-understand.md
##########
@@ -410,6 +410,24 @@ You can define the `schemaDefinition` to generate a 
`struct` schema.
     User user = consumer.receive().getValue();
     ```
 
+4. Use a custom `Serialization` method, such as json configuration method, the 
following is the default
+
+   ```java
+   ObjectMapper mapper = new ObjectMapper();
+   mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+   mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+   mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+   JacksonJsonWriter<User> writer = new JacksonJsonWriter<>(mapper);
+   JacksonJsonReader<User> reader = new JacksonJsonReader<>(mapper, 
User.class);
+   
+   SchemaDefinition<User> schemaDefinition = SchemaDefinition.<User>builder()
+                                                         .withPojo(User.class)
+                                                         
.withSchemaWriter(writer)
+                                                         
.withSchemaReader(reader)
+                                                         .build();
+   ```
+   You can define `SchemaWriter` and `SchemaReader` as singletons

Review comment:
       @congbobo184 can you help review it from the technical perspective? 
Thanks




-- 
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