tisonkun commented on code in PR #17863:
URL: https://github.com/apache/pulsar/pull/17863#discussion_r990174850


##########
site2/docs/concepts-messaging.md:
##########
@@ -87,17 +89,29 @@ You can set producer access mode through Java Client API. 
For more information,
 
 ### Compression
 
-You can compress messages published by producers during transportation. Pulsar 
currently supports the following types of compression:
-
+Message compression can reduce message size by paying some CPU overhead. The 
Pulsar client supports the following compression types:
 * [LZ4](https://github.com/lz4/lz4)
 * [ZLIB](https://zlib.net/)
 * [ZSTD](https://facebook.github.io/zstd/)
-* [SNAPPY](https://google.github.io/snappy/)
+* [SNAPPY](https://google.github.io/snappy/). 
+ 
+Compression types are stored in the message metadata, so consumers can adopt 
different compression types automatically, as needed.
+
+The sample code below shows how to enable compression type for a producer:
+
+```
+client.newProducer()
+    .topic(“topic-name”) 
+    .compressionType(CompressionType.LZ4) 
+    .create();
+```
 
 ### Batching
 
 When batching is enabled, the producer accumulates and sends a batch of 
messages in a single request. The batch size is defined by the maximum number 
of messages and the maximum publish latency. Therefore, the backlog size 
represents the total number of batches instead of the total number of messages.
 
+![Batching](/assets/batching.svg)

Review Comment:
   @merlimat @Anonymitaet @urfreespace @momo-jun 
   
   Since @DaveDuggins doesn't upload these SVG files, the site build is 
currently broken: 
https://github.com/apache/pulsar-site/actions/runs/3204572728/jobs/5236018179.
   
   If @DaveDuggins can provide the files, I'm glad to help with submitting a 
patch. Otherwise, we may firstly revert this commit.



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