简体   繁体   中英

How can consumer check if the schema registry is reachable before getting data from Kafka broker?

As I know, a Kafka consumer will go to schema registry to fetch and cache data schema for future uses at 1st time deserializing the avro data from broker.

Would it be possible for a consumer process to check first if the schema registry is reachable (like network issue or registry accidentally down or whatever) before all these begin?

You could use CachedSchemaRegistryClient or HttpURLConnection class outside of the Consumer loop to do a HTTP connection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM