nowinkeyy commented on issue #5055:
URL: https://github.com/apache/rocketmq/issues/5055#issuecomment-1246559335

   > In fact, to solve the problem of automatic creation 
(autoCreateTopicEnable) from RocketMQ 4.3.0, Rocketmq provides a topicKey to 
specify the default topic, as shown in the following code:
   > 
   > ```
   > DefaultMQProducer producer = new 
DefaultMQProducer("please_rename_unidcque_group_name");
   > //Set the key value of automatic topic creation
   > producer.setCreateTopicKey("AUTO_CREATE_TOPIC_KEY");
   > ```
   >
   > After the instance information of namesrv is registered, you can solve the 
above problem by setting the topicKey
   
   
   
   > In fact, to solve the problem of automatic creation 
(autoCreateTopicEnable) from RocketMQ 4.3.0, Rocketmq provides a topicKey to 
specify the default topic, as shown in the following code:
   > 
   > ```
   > DefaultMQProducer producer = new 
DefaultMQProducer("please_rename_unidcque_group_name");
   > //Set the key value of automatic topic creation
   > producer.setCreateTopicKey("AUTO_CREATE_TOPIC_KEY");
   > ```
   > 
   > After the instance information of namesrv is registered, you can solve the 
above problem by setting the topicKey
   
   ```
   private String createTopicKey = TopicValidator.AUTO_CREATE_TOPIC_KEY_TOPIC;
   public static final String AUTO_CREATE_TOPIC_KEY_TOPIC = "TBW102";
   ```
   Your idea seems to be just to change the TBW102 topic something else. If use 
TBW102, the broker does't need to register the topic in advance. If use 
setCreateTopicKey(), the broker must register the topic in advance then 
producer could send messages to the broker( it mens autoCreateTopic is invalid 
).  **This is my simple test out, if there is a mistake, please point out.**


-- 
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]

Reply via email to