Commit 796c95b 1 parent 9202de3 commit 796c95b Copy full SHA for 796c95b
File tree 4 files changed +27
-12
lines changed
proxy/src/main/java/org/apache/rocketmq/proxy
4 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ maven_install(
71
71
"org.bouncycastle:bcpkix-jdk15on:1.69" ,
72
72
"com.google.code.gson:gson:2.8.9" ,
73
73
"com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2" ,
74
- "org.apache.rocketmq:rocketmq-proto:2.0.3 " ,
74
+ "org.apache.rocketmq:rocketmq-proto:2.0.4 " ,
75
75
"com.google.protobuf:protobuf-java:3.20.1" ,
76
76
"com.google.protobuf:protobuf-java-util:3.20.1" ,
77
77
"com.conversantmedia:disruptor:1.2.10" ,
Original file line number Diff line number Diff line change 126
126
<annotations-api .version>6.0.53</annotations-api .version>
127
127
<extra-enforcer-rules .version>1.0-beta-4</extra-enforcer-rules .version>
128
128
<concurrentlinkedhashmap-lru .version>1.4.2</concurrentlinkedhashmap-lru .version>
129
- <rocketmq-proto .version>2.0.3 </rocketmq-proto .version>
129
+ <rocketmq-proto .version>2.0.4 </rocketmq-proto .version>
130
130
<grpc .version>1.53.0</grpc .version>
131
131
<protobuf .version>3.20.1</protobuf .version>
132
132
<disruptor .version>1.2.10</disruptor .version>
641
641
<version >${rocketmq-proto.version} </version >
642
642
<exclusions >
643
643
<exclusion >
644
- <groupId >io.grpc</groupId >
645
- <artifactId >grpc-protobuf</artifactId >
646
- </exclusion >
647
- <exclusion >
648
- <groupId >io.grpc</groupId >
649
- <artifactId >grpc-stub</artifactId >
650
- </exclusion >
651
- <exclusion >
652
- <groupId >io.grpc</groupId >
653
- <artifactId >grpc-netty-shaded</artifactId >
644
+ <groupId >*</groupId >
645
+ <artifactId >*</artifactId >
654
646
</exclusion >
655
647
</exclusions >
656
648
</dependency >
1097
1089
</exclusion >
1098
1090
</exclusions >
1099
1091
</dependency >
1092
+
1093
+ <dependency >
1094
+ <groupId >jakarta.annotation</groupId >
1095
+ <artifactId >jakarta.annotation-api</artifactId >
1096
+ <version >1.3.5</version >
1097
+ </dependency >
1100
1098
</dependencies >
1101
1099
</dependencyManagement >
1102
1100
Original file line number Diff line number Diff line change @@ -103,6 +103,10 @@ public class ProxyConfig implements ConfigFile {
103
103
* max message body size, 0 or negative number means no limit for proxy
104
104
*/
105
105
private int maxMessageSize = 4 * 1024 * 1024 ;
106
+ /**
107
+ * if true, proxy will check message body size and reject msg if it's body is empty
108
+ */
109
+ private boolean enableMessageBodyEmptyCheck = true ;
106
110
/**
107
111
* max user property size, 0 or negative number means no limit for proxy
108
112
*/
@@ -1525,4 +1529,12 @@ public boolean isEnableBatchAck() {
1525
1529
public void setEnableBatchAck (boolean enableBatchAck ) {
1526
1530
this .enableBatchAck = enableBatchAck ;
1527
1531
}
1532
+
1533
+ public boolean isEnableMessageBodyEmptyCheck () {
1534
+ return enableMessageBodyEmptyCheck ;
1535
+ }
1536
+
1537
+ public void setEnableMessageBodyEmptyCheck (boolean enableMessageBodyEmptyCheck ) {
1538
+ this .enableMessageBodyEmptyCheck = enableMessageBodyEmptyCheck ;
1539
+ }
1528
1540
}
Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ protected int buildSysFlag(apache.rocketmq.v2.Message protoMessage) {
132
132
}
133
133
134
134
protected void validateMessageBodySize (ByteString body ) {
135
+ if (ConfigurationManager .getProxyConfig ().isEnableMessageBodyEmptyCheck ()) {
136
+ if (body .isEmpty ()) {
137
+ throw new GrpcProxyException (Code .MESSAGE_BODY_EMPTY , "message body cannot be empty" );
138
+ }
139
+ }
135
140
int max = ConfigurationManager .getProxyConfig ().getMaxMessageSize ();
136
141
if (max <= 0 ) {
137
142
return ;
You can’t perform that action at this time.
0 commit comments