RockteMQ-AI commented on issue #1288: URL: https://github.com/apache/rocketmq-clients/issues/1288#issuecomment-4811725087
**Issue Evaluation** Category: `type/new-feature` | Status: **Evaluated** **Feasibility:** Feasible **Scope:** `java/client` module — `PublishingMessageImpl`, `PublishingSettings`, potentially `ClientConfig` / `ProducerBuilder` The observation is correct. While `Utilities.java` already provides `compressBytesZSTD()`, `compressBytesZLIB()`, `compressBytesLZ4()`, and `compressBytesGZIP()` utility methods, and `MessageViewImpl` handles decompression on the receiving side, the publishing path in `PublishingMessageImpl#toProtobuf()` does not apply any compression to the message body before encoding it into the protobuf. The body is sent as-is (identity encoding). **What is needed:** 1. Expose a compression configuration option in the producer builder (e.g., `CompressionType.ZSTD` / `ZLIB` / `LZ4` / `GZIP`) 2. Apply the selected compression in `PublishingMessageImpl` before the body is set into the protobuf 3. Set the corresponding `Encoding` field in the protobuf so the consumer side knows which decompression algorithm to use 4. The decompression path on the consumer side (`MessageViewImpl`) already supports all four formats — no change needed there **Considerations:** - Compression should only apply when body size exceeds a configurable threshold (similar to the existing `PublishingSettings` compression threshold concept) - The protobuf `Encoding` enum must be checked to ensure it already supports the desired compression types - Cross-language compatibility: if the broker/proxy or other language clients need to handle the compressed messages, ensure they support the same compression formats This is a valuable enhancement for large-message scenarios. A PR would be welcome. --- *Automated evaluation by github-manager-bot* -- 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]
