mirror of
https://github.com/apache/rocketmq.git
synced 2026-08-30 18:10:44 +08:00
This commit is contained in:
@@ -71,7 +71,7 @@ maven_install(
|
||||
"org.bouncycastle:bcpkix-jdk15on:1.69",
|
||||
"com.google.code.gson:gson:2.8.9",
|
||||
"com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2",
|
||||
"org.apache.rocketmq:rocketmq-proto:2.0.3",
|
||||
"org.apache.rocketmq:rocketmq-proto:2.0.4",
|
||||
"com.google.protobuf:protobuf-java:3.20.1",
|
||||
"com.google.protobuf:protobuf-java-util:3.20.1",
|
||||
"com.conversantmedia:disruptor:1.2.10",
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<annotations-api.version>6.0.53</annotations-api.version>
|
||||
<extra-enforcer-rules.version>1.0-beta-4</extra-enforcer-rules.version>
|
||||
<concurrentlinkedhashmap-lru.version>1.4.2</concurrentlinkedhashmap-lru.version>
|
||||
<rocketmq-proto.version>2.0.3</rocketmq-proto.version>
|
||||
<rocketmq-proto.version>2.0.4</rocketmq-proto.version>
|
||||
<grpc.version>1.53.0</grpc.version>
|
||||
<protobuf.version>3.20.1</protobuf.version>
|
||||
<disruptor.version>1.2.10</disruptor.version>
|
||||
@@ -641,16 +641,8 @@
|
||||
<version>${rocketmq-proto.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-protobuf</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-stub</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.grpc</groupId>
|
||||
<artifactId>grpc-netty-shaded</artifactId>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
@@ -1097,6 +1089,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>1.3.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
@@ -103,6 +103,10 @@ public class ProxyConfig implements ConfigFile {
|
||||
* max message body size, 0 or negative number means no limit for proxy
|
||||
*/
|
||||
private int maxMessageSize = 4 * 1024 * 1024;
|
||||
/**
|
||||
* if true, proxy will check message body size and reject msg if it's body is empty
|
||||
*/
|
||||
private boolean enableMessageBodyEmptyCheck = true;
|
||||
/**
|
||||
* max user property size, 0 or negative number means no limit for proxy
|
||||
*/
|
||||
@@ -1525,4 +1529,12 @@ public class ProxyConfig implements ConfigFile {
|
||||
public void setEnableBatchAck(boolean enableBatchAck) {
|
||||
this.enableBatchAck = enableBatchAck;
|
||||
}
|
||||
|
||||
public boolean isEnableMessageBodyEmptyCheck() {
|
||||
return enableMessageBodyEmptyCheck;
|
||||
}
|
||||
|
||||
public void setEnableMessageBodyEmptyCheck(boolean enableMessageBodyEmptyCheck) {
|
||||
this.enableMessageBodyEmptyCheck = enableMessageBodyEmptyCheck;
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -132,6 +132,11 @@ public class SendMessageActivity extends AbstractMessingActivity {
|
||||
}
|
||||
|
||||
protected void validateMessageBodySize(ByteString body) {
|
||||
if (ConfigurationManager.getProxyConfig().isEnableMessageBodyEmptyCheck()) {
|
||||
if (body.isEmpty()) {
|
||||
throw new GrpcProxyException(Code.MESSAGE_BODY_EMPTY, "message body cannot be empty");
|
||||
}
|
||||
}
|
||||
int max = ConfigurationManager.getProxyConfig().getMaxMessageSize();
|
||||
if (max <= 0) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user