使用spring kafka连接到msk

mrwjdhj3  于 2021-06-05  发布在  Kafka
关注(0)|答案(0)|浏览(242)

嗨,我正在使用aws-msk,并试图连接到它使用SpringKafka客户端。从代码向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
topic-topic1确实存在,我可以从命令行列出它
请帮忙。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题