0

嗨,我正在使用 aws MSK 并尝试使用 spring kafka 客户端连接到它。从我的代码向 kafka 集群发送消息时,出现以下错误-

2020-01-27 21:49:17.141 ERROR 4176 --- [nio-9000-exec-4] o.s.k.support.LoggingProducerListener    : Exception thrown when sending a message with key='key' and payload='payload' to topic topic1:

org.apache.kafka.common.errors.TimeoutException: Topic topic1 not present in metadata after 60000 ms.

这是我的配置-

spring:
  kafka:
    consumer:
      bootstrap-servers: {server}
      group-id: group_id
      auto-offset-reset: earliest
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
      ssl:
        trust-store-location: /tmp/kafka.client.truststore.jks
        key-store-location: /tmp/kafka.client.truststore.jks
        protocol: ssl
    producer:
      bootstrap-servers: {server}
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
      ssl:
        trust-store-location: /tmp/kafka.client.truststore.jks
        key-store-location: /tmp/kafka.client.truststore.jks
        protocol: ssl

我可以按照此处的步骤使用命令行连接到 kafka 集群(生产和消费消息) - https://docs.aws.amazon.com/msk/latest/developerguide/produce-consume.html

主题 - topic1 确实存在,我可以从命令行列出它

请帮忙。

4

0 回答 0