Class KafkaSchemaRegistryClient
- java.lang.Object
-
- dev.lydtech.component.framework.client.kafka.KafkaSchemaRegistryClient
-
public class KafkaSchemaRegistryClient extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KafkaSchemaRegistryClientgetInstance()protected StringgetSchemaRegistryBaseUrl()intregisterSchema(String subject, String schema)Register the schema derived from the avro generated class.voidresetSchemaRegistry()Deletes registered schemas from the registry.
-
-
-
Method Detail
-
getInstance
public static KafkaSchemaRegistryClient getInstance()
-
getSchemaRegistryBaseUrl
protected String getSchemaRegistryBaseUrl()
-
resetSchemaRegistry
public void resetSchemaRegistry() throws ExceptionDeletes registered schemas from the registry.- Throws:
Exception
-
registerSchema
public int registerSchema(String subject, String schema) throws Exception
Register the schema derived from the avro generated class. To get the schema, call getClassSchema() on the Avro generated class. e.g. SendPayment.getClassSchema().toString() The subject is calculated from the Class. The hyphenated lower case String based on the avro generated class name, with a "-value" suffix. e.g. SendPayment is send-payment-value.- Parameters:
subject- the subject (topic name) of the schema being registeredschema- the schema JSON string- Returns:
- schemaId the schemaId used to register this Avro schema
- Throws:
Exception
-
-