majialoong commented on code in PR #9787: URL: https://github.com/apache/rocketmq/pull/9787#discussion_r2497780450
########## tools/src/main/java/org/apache/rocketmq/tools/command/broker/SwitchTimerEngineSubCommand.java: ########## @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.rocketmq.tools.command.broker; +import java.util.Set; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.Options; +import org.apache.commons.lang3.StringUtils; +import org.apache.rocketmq.common.message.MessageConst; +import org.apache.rocketmq.remoting.RPCHook; +import org.apache.rocketmq.srvutil.ServerUtil; +import org.apache.rocketmq.tools.admin.DefaultMQAdminExt; +import org.apache.rocketmq.tools.command.CommandUtil; +import org.apache.rocketmq.tools.command.SubCommand; +import org.apache.rocketmq.tools.command.SubCommandException; + +public class SwitchTimerEngineSubCommand implements SubCommand { + private static final String ROCKSDB_TIMELINE = "ROCKSDB_TIMELINE"; + private static final String FILE_TIME_WHEEL = "FILE_TIME_WHEEL"; + + @Override + public String commandName() { + return "switchTimerEngine"; + } + + @Override + public String commandDesc() { + return "switch the engine of timer message in broker"; + } + + @Override + public Options buildCommandlineOptions(Options options) { + Option opt = new Option("b", "brokerAddr", true, "update which broker"); + opt.setRequired(false); + options.addOption(opt); + + opt = new Option("c", "clusterName", true, "update which cluster"); Review Comment: @RongtongJin Thank you for your explanation. Yes, your description is correct; the code I marked might be misleading. When specifying a `broker`, you don't need to set the `clusterName`. However, you must choose between setting either the `broker` or the `clusterName`; this isn't mandatory in the current code.The current code doesn't enforce this; it only reminds the user to enter the `e` parameter. <img width="648" height="135" alt="image" src="https://github.com/user-attachments/assets/d71fb87e-cdc5-4be1-93bb-f45290d33579" /> Furthermore, other commands will use `OptionGroup` to remind the user that either the broker or the clusterName must be configured. https://github.com/apache/rocketmq/blob/440341b6044455b600f25cac1cf98c1f4fb5b5a8/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java#L50-L59 -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
