0

So I know how to create topics on Confluent Cloud with the confluent_kafka AdminClient instance but I’m not sure how to set the topic’s message schema programmatically? To clarify, I have the schema I want to use saved locally in an avro schema file(.avsc)

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
user1943079
  • 511
  • 6
  • 20

1 Answers1

0

Use the AdminClient to create the topic and then use the SchemaRegistryClient to register the schema for the topic.

Apoleo
  • 2,045
  • 2
  • 21
  • 37
  • any documentation on how to do this with the confluent_kafka python library? From this link, https://docs.confluent.io/platform/current/clients/confluent-kafka-python/html/index.html#schemaregistry-client, it doesn’t look like any methods support registering a schema to a specific topic – user1943079 Jan 20 '23 at 01:30
  • @user1943079 Because you can't. Topics dont have schemas. Only the Registry has **subjects**, which (optionally) map to topic names. You need to use HTTP clients to talk to the Registry, not Kafka clients. – OneCricketeer Jan 24 '23 at 23:42