zzzming opened a new pull request #236: URL: https://github.com/apache/pulsar-client-go/pull/236
### Motivation This PR will fix a problem preventing consumer receiving empty payload with properties in non-batch mode; and empty payload without key and properties in batch mode. Error messages are prompted currently as such: ``` ERRO[0004] Discarding corrupted message msgID="ledgerId:92658 entryId:1458 partition:-1 " name=hwmiw subscription=consumer topic="<pulsar topic>" validationError=BatchDeSerializeError ERRO[0004] handle message Id: ledgerId:92658 entryId:1458 partition:-1 consumerID=1 local_addr="192.168.1.111:33444" remote_addr="<pulsar URL>" ``` In addition, error will be printed out from MessageReceived instead of masking the real error reported. ### Modifications The buffer capacity is validated instead of solely replying on ReadableBytes to determine EOF is reached. ### Verifying this change Tested against batch and nonbatch mode to consume empty payload with and without properties. ### Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (no) - The public API: (no) - The schema: ( no) - The default values of configurations: (no) - The wire protocol: (no) ### Documentation - Does this pull request introduce a new feature? (no) - If yes, how is the feature documented? (not applicable) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org