This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.wiki.git


The following commit(s) were added to refs/heads/master by this push:
     new af22c50  Updated PIP 36: Max Message Size (markdown)
af22c50 is described below

commit af22c5016b4ed2080b766dcd9085702fbbcc1780
Author: Sijie Guo <[email protected]>
AuthorDate: Fri May 17 02:18:12 2019 -0700

    Updated PIP 36: Max Message Size (markdown)
---
 PIP-36:-Max-Message-Size.md | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/PIP-36:-Max-Message-Size.md b/PIP-36:-Max-Message-Size.md
index 43f851b..45f8a2d 100644
--- a/PIP-36:-Max-Message-Size.md
+++ b/PIP-36:-Max-Message-Size.md
@@ -40,3 +40,32 @@ private void completeConnect(int clientProtoVersion, String 
clientVersion, long
 ```
 
 On client side, client should set max message size in configuration and it 
should be smaller than server support.
+
+### Implement
+We defined three value about message size in `Commands`:
+
+       - DEFAULT_MAX_MESSAGE_SIZE = 5 * 1024 * 1024
+       - MESSAGE_SIZE_FRAME_PADDING = 10 * 1024
+       - INVALID_MAX_MESSAGE_SIZE = -1
+
+> **DEFAULT_MAX_MESSAGE_SIZE** is used to set where is not specify the max 
message size. And **MESSAGE_SIZE_FRAME_PADDING** is the message meta info size. 
Sometimes the message size is not necessary in *Connected* so you can choose 
**INVALID_MAX_MESSAGE_SIZE** and it will not in *Connected*  command. 
+
+**Broker**
+ we need send `max_message_size` to clients when broker complete connect:
+```
+// complete the connect and sent newConnected command
+private void completeConnect(int clientProtoVersion, String clientVersion, 
long maxMessageSize) {
+ ctx.writeAndFlush(Commands.newConnected(clientProtoVersion, maxMessageSize));
+ state = State.Connected;
+ remoteEndpointProtocolVersion = clientProtoVersion;
+ if (isNotBlank(clientVersion) && !clientVersion.contains(" ") /* ignore 
default version: pulsar client */) {
+ this.clientVersion = clientVersion.intern();
+ }
+}
+```
+
+**Client**
+Client shouldn’t set max message size in configuration and When client connect 
server it will get the max message size how broker can received. And it 
replaces the `LengthFieldBasedFrameDecoder` once it get the new message size. 
When client sends messages it will compare with the message size, it will throw 
an exception once the message size exceed.
+
+**Proxy**
+It will have two operation when client connect to proxy. One is client is 
looking up brokers and another is client has know which broker to connect and 
it connecting to broker. There is no messages except connect message is 
transferring between proxy and client when client just looking up brokers. So 
it needn’t set message size when proxy connected. But when client has know 
which broker to connect proxy server will create a direct proxy, then proxy and 
client will receive the message max [...]

Reply via email to