Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
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;
Expand Down Expand Up @@ -439,6 +440,13 @@ private synchronized RemotingCommand updateAndCreateTopic(ChannelHandlerContext
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()) {
Expand Down
10 changes: 10 additions & 0 deletions common/src/main/java/org/apache/rocketmq/common/BrokerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ public class BrokerConfig extends BrokerIdentity {
*/
private boolean enableSingleTopicRegister = false;

private boolean enableMixedMessageType = false;

public long getMaxPopPollingSize() {
return maxPopPollingSize;
}
Expand Down Expand Up @@ -1703,4 +1705,12 @@ public boolean isEnableSingleTopicRegister() {
public void setEnableSingleTopicRegister(boolean enableSingleTopicRegister) {
this.enableSingleTopicRegister = enableSingleTopicRegister;
}

public boolean isEnableMixedMessageType() {
return enableMixedMessageType;
}

public void setEnableMixedMessageType(boolean enableMixedMessageType) {
this.enableMixedMessageType = enableMixedMessageType;
}
}
Loading