【问题标题】:Spring cloud contract tests for avro messages using Schema RegistrySpring Cloud Contract 使用 Schema Registry 测试 avro 消息
【发布时间】:2021-06-13 17:08:22
【问题描述】:

我正在查看 spring docs 和 spring github,我可以看到一些非常基本的 examples 异步 kafka 消息传递(生产者和消费者)通过 json 消息和 Kafka 主题进行通信,但似乎没有示例对于更多的生产,比如消息不是 json 而是 avro 的设置,而 Schema Registry(例如 Confluent 的)也在图片中。我对此感到非常惊讶,因为当基于事件的微服务通过生成/使用 avro 消息进行通信时,必须进行合约测试以避免在 avro 模式演变时出现运行时异常,并在构建期间捕获它们。我想知道是否有人已经解决了这个问题。任何方向都非常感谢!

【问题讨论】:

    标签: java avro spring-kafka confluent-schema-registry spring-cloud-contract


    【解决方案1】:

    没有明确支持spring cloud contract和avro。但是,我们确实支持针对现有中间件的工作。这里有一个针对真正的 kafka 代理进行测试的示例 - 生产者:https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/producer_kafka_middleware 和消费者:https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/consumer_kafka_middleware

    如有必要,您可以运行其他中间件,包括架构注册表。

    【讨论】:

      猜你喜欢
      • 2018-01-31
      • 2018-05-17
      • 2019-12-09
      • 2019-04-09
      • 1970-01-01
      • 1970-01-01
      • 2020-06-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多