tisonkun commented on code in PR #17863: URL: https://github.com/apache/pulsar/pull/17863#discussion_r990178789
########## 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. + Review Comment: Create issue at https://github.com/apache/pulsar/issues/17960. New patch can link there. -- 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]
