GitHub user powertoredstar created a discussion: Why I can't update TopicConfig
by DefaultMQAdminExt?
my operations as follows:
1.create a topic by createTopic method
2.create a topicConfig I want to update
3.get all broker ip
4.update topicConfig on each broker
```
@Test
public void createTopic() throws MQClientException, MQBrokerException,
RemotingException, InterruptedException {
DefaultMQAdminExt admin = new DefaultMQAdminExt();
admin.setNamesrvAddr("10.30.18.78:19876");
admin.start();
String clusterName = "DefaultCluster";
String topicName = "AI-CHAT-TOPIC";
admin.createTopic(clusterName, topicName, 1, null);
TopicRouteData topicRouteData = admin.examineTopicRouteInfo(topicName);
TopicConfig topicConfig = new TopicConfig();
topicConfig.setTopicName(topicName);
topicConfig.setTopicSysFlag(0);
topicConfig.setPerm(6);
topicConfig.setWriteQueueNums(1);
topicConfig.setReadQueueNums(1);
topicConfig.setTopicMessageType(TopicMessageType.FIFO);
topicConfig.setOrder( true);
List<BrokerData> brokerDatas = topicRouteData.getBrokerDatas();
for(BrokerData brokerData: brokerDatas){
System.out.println(brokerData.getBrokerName() + ":" +
brokerData.getBrokerAddrs());
String brokerIp = brokerData.selectBrokerAddr();
System.out.println("brokerId:"+brokerIp);
admin.createAndUpdateTopicConfig(brokerIp, topicConfig);
}
admin.shutdown();
}
```
but I encounted an error on `admin.createAndUpdateTopicConfig(brokerIp,
topicConfig)`;
```
broker-b:{0=10.30.18.78:31911}
brokerId:10.30.18.78:31911
org.apache.rocketmq.client.exception.MQClientException: CODE: 1 DESC:
add/alter attribute format is wrong: message.type
For more information, please visit the url,
https://rocketmq.apache.org/docs/bestPractice/06FAQ
at
org.apache.rocketmq.client.impl.MQClientAPIImpl.createTopic(MQClientAPIImpl.java:452)
at
org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.createAndUpdateTopicConfig(DefaultMQAdminExtImpl.java:258)
at
org.apache.rocketmq.tools.admin.DefaultMQAdminExt.createAndUpdateTopicConfig(DefaultMQAdminExt.java:202)
at TopicManagerExample.createTopic(TopicManagerExample.java:57)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
```
why the attribute format is wrong: message.type?
My main purpose is to change the message type after I create a topic manually.
GitHub link: https://github.com/apache/rocketmq/discussions/9647
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]