You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/07 14:50:01 UTC

[GitHub] [pulsar] tisonkun commented on a diff in pull request #17863: [doc][improve] update concepts-messaging.md

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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org