Saddam Hussain I H
Saddam Hussain I H

Reputation: 200

Create subjects automatically from Schema Registry - Subject not found

I have Schema Registry container http://registry-server:8081

ProducerConfig:

     bootstrap.servers : [PLAINTEXT://kafka-server:9092]
     value.serializer : class org.apache.kafka.common.serialization.ByteArraySerializer

and a Standalone service that acts as a producer and has its property set as below

Producer

   "schema.registry.url", "http://registry-server:8081"
   "bootstrap.servers", "http://kafka-server:9092
   "value.converter.value.subject.name.strategy", true
   "auto.register.schemas", false
   "value.serializer", DelegatingSerialzer.class

KafkaAvroSerializerConfig

    value.subject.name.strategy = class io.confluent.kafka.serializers.subject.TopicNameStrategy
    key.subject.name.strategy = class io.confluent.kafka.serializers.subject.TopicNameStrategy

But when the Standalone service attempt to send a request to schema registry, something like below

   http://registry-server:8081/subjects/topicName-value?deleted=false

I constantly receive Subject Not Found error.

Is it because auto.register.schemas is set to false in the Producer from standalone service and that's why it is failing to create subjects ?

How can I auto register schema and auto create Subject from the Schema Registry service ?

btw, kafka, schema-registery and standalone-app are containers

Upvotes: 1

Views: 1314

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191973

Is it because auto.register.schemas is set to false in the Producer from standalone service and that's why it is failing to create subjects ?

Probably

auto register schema and auto create Subject from the Schema Registry service ?

You can't. The registry needs to have external POST HTTP requests sent to it to create schemas for subjects. You cannot create subject without any schema.

The registry itself doesn't start with any schema, usually only your client applications do, so there is nothing it can (auto) register itself.

Upvotes: 0

Related Questions