shuoqingding commented on issue #21631:
URL: https://github.com/apache/pulsar/issues/21631#issuecomment-1831142505
@Technoboy- Hi Jiwei, I am happy to submit a PR, however I want to discuss
the expected behavior before working on it.
As I understand it, the usage of `canAdd` is to keep the batch size as
limited (introduced in #4621), and to solve this issue, a simple solution is to
allow the message to-be-added is larger than the policy limit as below, but I
am not sure if this will break the original design. cc @codelipenghui
```
protected boolean canAdd(Message<T> message) {
...
if (maxSizeOfMessages > 0) {
// we allow to add message which size is larger than
maxSizeOfMessages, to avoid blocking the consumer
if (message.getData().length > maxSizeOfMessages) {
return true;
}
if (currentSizeOfMessages + message.getData().length >
maxSizeOfMessages) {
return false;
}
}
return true;
}
```
--
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]