【问题标题】:Spring cloud stream to send message to topics hosted on ConfluentSpring Cloud Stream 向 Confluent 上托管的主题发送消息
【发布时间】:2020-12-27 11:41:17
【问题描述】:

我编写了一个 Spring 云流消息生成器,它成功地将有效负载发布到我本地引导服务器上的主题。我想将有效负载发布到我在 Confluent Cloud 上创建的主题上。我需要进行哪些配置更改?以下是正在运行的 localhost 的配置。


spring:
  cloud:
    stream:
      bindings:
        output:
          destination: ordersTopic
          content-type: application/json
      kafka:
        binder:
          zkNodes: localhost
          brokers: localhost
      default-binder: kafka

【问题讨论】:

    标签: apache-kafka spring-cloud-stream spring-cloud-stream-binder-kafka


    【解决方案1】:

    您不再需要zkNodes - 现代 Kafka 客户端仅直接与代理对话,而不与 zookeeper 对话。您使用的是什么版本的 spring-cloud-stream?该属性 (zkNodes) 在最近的版本中不再存在。

    您需要设置brokers 属性以匹配代理的server.properties 文件中配置为广告侦听器的主机/端口的任何内容。

    【讨论】:

    • API 访问密钥和秘密密钥如何。是否有连接到 Confluent.io 的文档。我正在使用 spring-cloud-stream 的 3.0.9.RELEASE 版本
    • 这超出了 Spring 的范围;对不起;我们只是委托给 kafka-clients;请参阅 Kafka 和 Confluent 文档。
    • 我发现一些文档here 看起来像您将它们添加为属性;您可以通过 ...kafka.binder.configuration 属性设置任意 Kafka 属性;例如...kafka.binder.configuration.foo.bar: baz。还有一个...jaas 属性,以备不时之需。
    猜你喜欢
    • 2021-06-12
    • 2020-03-20
    • 1970-01-01
    • 2021-04-27
    • 2020-09-18
    • 2018-07-18
    • 2022-07-01
    • 1970-01-01
    • 2016-09-09
    相关资源
    最近更新 更多