簡體   English   中英

如何使用 Schema Registry / Kafka-Rest 正確注冊 Protobuf schema

[英]how to properly register Protobuf schema with Schema Registry / Kafka-Rest

我正在嘗試使用 kafka-rest 接口將 Protobuf 模式發布到模式注冊表:

curl -X POST -H "Content-Type: application/vnd.kafka.protobuf.v2+json" \
   -H "Accept: application/vnd.kafka.v2+json" \
   --data '{"value_schema": "syntax=\"proto3\"; message User { string name = 1; }", "records": [{"value": {"name": "testUser"}}]}' \
   "http://localhost:8082/topics/protobuftest"

我收到此錯誤:

{"error_code":415,"message":"HTTP 415 Unsupported Media Type"}

問題:指示此工作的媒體類型的正確方法是什么?

您需要使用 JSON 信封發送它,因為它不是 avro 模式。

$ curl -X POST -H "content-type: application/json" 
http://localhost:8081/subjects/protobuf/versions 
-d "{\"schemaType\": \"PROTOBUF\", \"schema\": \"syntax = \\\"proto3\\\";message test { int32 id = 1; }\"}"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM