Как установить schema.registry.URL?

Я тестирую отправку GenericRecord. Но следующий код

let fullName = "Test k"
let uniEncoding = new UnicodeEncoding()
let str = uniEncoding.GetBytes("abcdefg")

use ms = new MemoryStream()
ms.Write(str, 0, str.Length)
let content = ms.ToArray()

let config = new Dictionary<string, Object>()
config.Add("bootstrap.servers", "10.0.0.2:9092")
config.Add("schema.registry.url", "http://bing.com")
let s = Schema.Parse(
            """{
                "namespace": "nnnnnnnn",
                "type": "record",
                "name": "fffffnnnnnn",
                "fields": [
                    {"name": "file_name", "type": "string"},
                    {"name": "time",  "type": "string"},
                    {"name": "content", "type": "bytes"}
                ]
                }""") :?> RecordSchema
use producer = new Producer<string, GenericRecord>(
                 config, new AvroSerializer<string>(), new AvroSerializer<GenericRecord>())
let record = new GenericRecord(s)
record.Add("file_name", fullName)
record.Add("time", DateTimeOffset.Now.ToString())
record.Add("content", content)
let dr = producer.ProduceAsync("Topic1", fullName, record).Result // error

0 // return an integer exit code

возвращает эту ошибку

HttpRequestException: [ http://bing.com/] ServiceUnavailable [ http://bing.com/] ServiceUnavailable -1

Какое значение я должен установить?

1 ответ

Решение

Что ж, bing.com не является реестром схемы

Вам необходимо скачать Confluent OSS Distribution, настроить и запустить (при условии, что Linux, но bin\windows\ работает иначе)

<confluent_home>/bin/schema-registry-start <confluent_home>/etc/schema-registry/schema-registry.properties

Тогда вы бы использовали что-то вроде http://schema-registry.server.name:8081/

Обратитесь к документации для получения дополнительной информации

Другие вопросы по тегам