Previous note: I am fairly new to Kafka.
I am trying to get all schemas from the Schema Registry, but I am not being able to do so only with a schema registry client. It only works if, prior to that, I instantiate a KafkaConsumer.
Can't understand why. Here's the code (with the consumer in place).
ConsumerConfig is just a class with all configurations needed. Including the Schema Registry URL.
Consumer<String, String> consumer = new KafkaConsumer<String, String>(ConsumerConfig.get());
CachedSchemaRegistryClient client = new CachedSchemaRegistryClient(ConsumerConfig.getSchemaRegistryURL(), 30);
Collection<String> listOfSubjects = client.getAllSubjects();
consumer.close();
Without the consumer, i get:
io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: No content to map due to end-of-input
With the consumer, everything works fine. I would like if someone could shine some light on why this happens, has I see no reason for me to need to connect to the actual Kafka Cluster via a consumer in order to access the Schema Registry that is on another endpoint.