[issue 447] double check message size when client enable compress
Fixes #447
Motivation
Try to fix issue #447.
Modifications
Compress the payload when the payload is too bigger, and check whever the 'compressed payload' is still bigger than expected.
Hello, I think this problem may be resolved in #805 . https://github.com/apache/pulsar-client-go/pull/805/files#diff-8adb09af2175be5751840343e14df2220a2154ca4bc8de21157ed112be25b6b9L521-L533
Is it possible to add some tests to verify it?
Hello, I think this problem may be resolved in #805 . https://github.com/apache/pulsar-client-go/pull/805/files#diff-8adb09af2175be5751840343e14df2220a2154ca4bc8de21157ed112be25b6b9L521-L533
![]()
Hi @Gleiphir2769, according to the implement of Java-Client, it should also check 'encryptedPayload' not only the payload in 'ProducerMessage'. The valid payload is encapsuled with metaData headers and payloads ([metaDataSize][metaData][payload]....)(refer to https://pulsar.apache.org/docs/developing-binary-protocol) https://github.com/apache/pulsar/blob/24c62c137670fcaff69ae91be30d2b531470ee03/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java#L201
Hello, I think this problem may be resolved in #805 . https://github.com/apache/pulsar-client-go/pull/805/files#diff-8adb09af2175be5751840343e14df2220a2154ca4bc8de21157ed112be25b6b9L521-L533
Hi @Gleiphir2769, according to the implement of Java-Client, it should also check 'encryptedPayload' not only the payload in 'ProducerMessage'. The valid payload is encapsuled with metaData headers and payloads ([metaDataSize][metaData][payload]....)(refer to https://pulsar.apache.org/docs/developing-binary-protocol) https://github.com/apache/pulsar/blob/24c62c137670fcaff69ae91be30d2b531470ee03/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java#L201
You are right. In the Java Client it checks "encryptedPayload" in batching. But Java Client only checks the "encryptedPayload" before sending when batching enabled, which means it will not check maxMessageSize in sendAsync. I think the check should be implemented in Flush or somewhere.