schema-registry icon indicating copy to clipboard operation
schema-registry copied to clipboard

KafkaAvroSerializer add a configured flag

Open gurpiarbassi opened this issue 3 years ago • 1 comments

It would be useful fo have a configured boolean flag on KafkaAvroSerializer to indicate that the call to configure() has already been made. This would be useful to check before you call it again and result in values being overwritten.

gurpiarbassi avatar May 13 '22 11:05 gurpiarbassi

Agree. For more context, we encountered this when passing pre-configured KafkaAvroSerializer into DefaultKafkaProducerFactory in spring-kafka. We do this to reuse the configured serde for Kafka Streams in vanilla Kafka context. Due to the change brought by https://github.com/spring-projects/spring-kafka/issues/1879, configure() will actually be called twice and will complain about missing schema registry url etc., if we only configure these in serde / serializer level. Similar to how their JsonSerializer guard against this with a configured flag, KafkaAvroSerializer should also do the same.

patrickpang avatar May 18 '22 14:05 patrickpang