[ISSUE #7153] Add switch for MIXED message type (#7154)

Add a switch for MIXED message type when creating a Topic in the Broker.
This commit is contained in:
ShuangxiDing
2023-08-10 17:41:15 +08:00
committed by GitHub
parent c0ba453f38
commit 8741ff8c9b
2 changed files with 18 additions and 0 deletions
@@ -59,6 +59,7 @@ import org.apache.rocketmq.common.TopicConfig;
import org.apache.rocketmq.common.UnlockCallback;
import org.apache.rocketmq.common.UtilAll;
import org.apache.rocketmq.common.attribute.AttributeParser;
import org.apache.rocketmq.common.attribute.TopicMessageType;
import org.apache.rocketmq.common.constant.ConsumeInitMode;
import org.apache.rocketmq.common.constant.FIleReadaheadMode;
import org.apache.rocketmq.common.constant.LoggerName;
@@ -439,6 +440,13 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
String attributesModification = requestHeader.getAttributes();
topicConfig.setAttributes(AttributeParser.parseToMap(attributesModification));
if (topicConfig.getTopicMessageType() == TopicMessageType.MIXED
&& !brokerController.getBrokerConfig().isEnableMixedMessageType()) {
response.setCode(ResponseCode.SYSTEM_ERROR);
response.setRemark("MIXED message type is not supported.");
return response;
}
try {
this.brokerController.getTopicConfigManager().updateTopicConfig(topicConfig);
if (brokerController.getBrokerConfig().isEnableSingleTopicRegister()) {
@@ -393,6 +393,8 @@ public class BrokerConfig extends BrokerIdentity {
*/
private boolean enableSingleTopicRegister = false;
private boolean enableMixedMessageType = false;
public long getMaxPopPollingSize() {
return maxPopPollingSize;
}
@@ -1712,4 +1714,12 @@ public class BrokerConfig extends BrokerIdentity {
public void setEnableSingleTopicRegister(boolean enableSingleTopicRegister) {
this.enableSingleTopicRegister = enableSingleTopicRegister;
}
public boolean isEnableMixedMessageType() {
return enableMixedMessageType;
}
public void setEnableMixedMessageType(boolean enableMixedMessageType) {
this.enableMixedMessageType = enableMixedMessageType;
}
}