GitHub user SpringDay6 edited a discussion: autoCreateTopicEnable=true is not
work
**rocketMq version**: rocketmq-all-5.1.3-bin-release
**client version** : rocketmq-client-java 5.0.5
### producer code :
public static void main(String[] args) throws ClientException {
// 接入点地址,需要设置成Proxy的地址和端口列表,一般是xxx:8081;xxx:8081。
String endpoint = "localhost:8081";
// 消息发送的目标Topic名称,需要提前创建。
String topic = "orderTopic4";
ClientServiceProvider provider = ClientServiceProvider.loadService();
ClientConfigurationBuilder builder =
ClientConfiguration.newBuilder().setEndpoints(endpoint);
ClientConfiguration configuration = builder.build();
// 初始化Producer时需要设置通信配置以及预绑定的Topic。
Producer producer = provider.newProducerBuilder()
.setTopics(topic)
.setClientConfiguration(configuration)
.build();
// Define your message body.
byte[] body = "This is a FIFO message for Apache
RocketMQ".getBytes(StandardCharsets.UTF_8);
String tag = "yourMessageTagA";
final Message message = provider.newMessageBuilder()
// Set topic for the current message.
.setTopic(topic)
// Message secondary classifier of message besides topic.
.setTag(tag)
// Key(s) of the message, another way to mark message besides
message id.
.setKeys("yourMessageKey-1ff69ada8e0e")
// Message group decides the message delivery order.
.setMessageGroup("yourMessageGroup0")
.setBody(body)
.build();
try {
final SendReceipt sendReceipt = producer.send(message);
log.info("Send message successfully, messageId={}",
sendReceipt.getMessageId());
} catch (Throwable t) {
log.error("Failed to send message", t);
}
// Close the producer when you don't need it anymore.
// You could close it manually or add this into the JVM shutdown hook.
// producer.shutdown();
}
**question:** the topic "orderTopic4" not exist,it report a bug with `DESC:
No topic route info in name server for the topic: orderTopic4`
I think i open `the autoCreateTopicEnable=true` but it doesn't create the topic
,it doesn't work
GitHub link: https://github.com/apache/rocketmq/discussions/7378
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]