codelipenghui opened a new pull request #8748: URL: https://github.com/apache/pulsar/pull/8748
fix https://github.com/streamnative/pulsar/issues/1723 ### Motivation The current policy to control the size of the message is at the broker level(maxMessageSize). It becomes easier to plan resource quotas for client allocation if the max message size pushed can be given at the topic level. ### Modifications Now the broker-level `maxMessageSize` is returned by the broker to the client, when the broker handles `handleConnected`. The client will cached `maxMessageSize` locally. An exception will be thrown if it exceeds the limit. Topic-level cannot be implemented like this, because: 1) When `handleConnected`, the command received by the broker does not contain specific topic information, so it is not known which topic policy to return to the client. 2) The client cannot cache topic-level policy. Unlike the broker-level policy, which will not change, the topic-level policy will change dynamically, which will involve cache consistency issues. I think the best way to handle this is to let the broker determine whether it exceeds the limit, and return an exception if it exceeds the limit, and handle the exception by the client's `handleSendError`. ### Verifying this change TopicPoliciesTest.java (cherry picked from commit 9c28378aea7da83164938c84fa6b55d0474fbbd8) ---------------------------------------------------------------- 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: [email protected]
