Kafka 生产者 - 无法将记录追加到只读镜像主题

问题描述 投票:0回答:1

我运行一个生产者并使用以下代码引发异常。

    @GetMapping("/send")
    public ResultVo send(@RequestParam(value = "content") String content) {
        return new ResultVo(kafkaTemplate.send("hello-topic", 0, "test", content));
    }

2023-08-07 21:00:12.330 ERROR 1508 --- [ad | producer-1] o.s.k.support.LoggingProducerListener    : Exception thrown when sending a message with key='test' and payload='test content' to topic hello-topic and partition 0:

org.apache.kafka.common.errors.InvalidRequestException: Cannot append records to read-only mirror topic

虽然生产者不起作用,但我写了一个消费者,可以正常获取消息。

    @KafkaListener(topics = "hello-topic", groupId = "hello-group")
    public void handleMessage(String content) {
         log.info("{}", content);
    }
java apache-kafka spring-kafka kafka-producer-api
1个回答
0
投票

镜像主题是只读的

您需要找到它们的镜像源,然后生成到该集群/主题。

© www.soinside.com 2019 - 2024. All rights reserved.