merlimat commented on a change in pull request #4247: [WIP] PIP-36: Support set
message size in broker.conf
URL: https://github.com/apache/pulsar/pull/4247#discussion_r284058150
##########
File path:
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/DirectProxyHandler.java
##########
@@ -270,8 +278,34 @@ protected void handleConnected(CommandConnected
connected) {
} else {
// Enable parsing feature, proxyLogLevel(1 or 2)
// Add parser handler
- inboundChannel.pipeline().addBefore("handler" ,
"inboundParser" , new ParserProxyHandler(inboundChannel ,
ParserProxyHandler.FRONTEND_CONN));
-
outboundChannel.pipeline().addBefore("proxyOutboundHandler" , "outboundParser"
, new ParserProxyHandler(outboundChannel , ParserProxyHandler.BACKEND_CONN));
+ if (connected.hasMaxMessageSize()) {
+ inboundChannel.pipeline().replace("frameDecoder",
"newFrameDecoder",
+ new
LengthFieldBasedFrameDecoder(connected.getMaxMessageSize()
+
+ Commands.MESSAGE_SIZE_FRAME_PADDING,
+
0, 4, 0, 4));
+ outboundChannel.pipeline().replace("frameDecoder",
"newFrameDecoder",
+ new
LengthFieldBasedFrameDecoder(
+
connected.getMaxMessageSize()
+ +
Commands.MESSAGE_SIZE_FRAME_PADDING, 0, 4, 0, 4));
+
+ inboundChannel.pipeline().addBefore("handler",
"inboundParser",
+ new
ParserProxyHandler(inboundChannel,
+
ParserProxyHandler.FRONTEND_CONN,
+
connected.getMaxMessageSize()));
+
outboundChannel.pipeline().addBefore("proxyOutboundHandler", "outboundParser",
+ new
ParserProxyHandler(outboundChannel,
+
ParserProxyHandler.BACKEND_CONN,
+
connected.getMaxMessageSize()));
+ } else {
+ inboundChannel.pipeline().addBefore("handler",
"inboundParser",
Review comment:
nit: the block should be indented
----------------------------------------------------------------
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]
With regards,
Apache Git Services