dongnan1899 2018-06-01 14:56
浏览 126

如何在Go中自动生成Avro模式?

I'm trying to integrate Avro and Schema Registry in our Kafka data pipelines. Now it looks inside of Go service like

Get data -> Encode data to JSON -> Write to Kafka

I want to use avro schema in the same way

Generate schema -> Update schema in Schema Registry -> Get data -> Encode to Avro -> Write to Kafka

But there are several questions:

  1. How can I generate schema from Go classes automatically?
  2. How should I check schema compatibility with Schema Registry?
  • 写回答

1条回答 默认 最新

  • duanliang9288 2018-06-04 12:12
    关注

    There are a few alternatives to create go classes from Avro. did you try this https://github.com/actgardner/gogen-avro?

    Usage To generate Go source files from one or more Avro schema files, run:

    gogen-avro [--package=] [--containers] output_directory avro_schema files

    Confluent Schema registry provide several ways to check compatibility betwween schemas. You can take a look to their API Here. There are other ways to do it, for example using maven during your integration tests to ensure compatibility between your source and other enviroments. You can find some information here.

    评论

报告相同问题?

悬赏问题

  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义