2016-11-21 4 views
0

コンフルエントなスキーマレジストリサービスにAVROスキーマを登録できますか? githubの上コンフルエントなスキーマレジストリでAVROスキーマを登録する

のreadmeを1として

https://github.com/confluentinc/schema-registry

すべての例では、任意の名前なしで単一のフィールドと型のJSONスキーマを使用しています。

私はリポジトリに次のスキーマを格納しようとしていますが、異形の異なるエラーが発生しています。

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"schema": "{"type": "record","name": "myrecord","fields": [{"name": "serialization","type": "string"},{"name": "compression","type": "string"},{"name": "encoding","type": "string"},{"name": "data","type": "string"}]}"}' 

それとも

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"schema": \"{\"type\": \"record\",\"name\": \"myrecord\",\"fields\": [{\"name\": \"data\",\"type\": \"string\"}]}\"}' http://localhost:8081/subjects/Kafka-key/versions 
+0

はい。絶対に。 次の例をご覧ください:https://github.com/confluentinc/examples/blob/3.1.x/kafka-streams/src/main/java/io/confluent/examples/streams/WikipediaFeedAvroLambdaExample.java –

+0

"あなたの質問にこれらのエラーが実際に含まれていれば助けになります。 –

答えて

0

アブロスキーマは、あなたは、いくつかのparamsが欠落しているコマンド

curl -X POST -i -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"schema": "{\"type\": \"record\",\"name\": \"myrecord\",\"fields\": [{\"name\": \"serialization\",\"type\": \"string\"},{\"name\": \"compression\",\"type\": \"string\"},{\"name\": \"encoding\",\"type\": \"string\"},{\"name\": \"data\",\"type\": \"string\"}]}"}' http://localhost:8081/subjects/Kafka-key/versions 

の下に使用してカフカを使用して登録することができます。

SchemaRegistryHelperを使用すると、任意のIDのスキーマを取得してデータを逆シリアル化できます。

関連する問題