Package com.bakdata.kafka
Class SchemaRegistryAppUtils
java.lang.Object
com.bakdata.kafka.SchemaRegistryAppUtils
Utility class that provides helpers for removing schemas associated with topics
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.confluent.kafka.schemaregistry.client.SchemaRegistryClientcreateSchemaRegistryClient(@NonNull Map<String, Object> configs, @NonNull String schemaRegistryUrl) Creates a newSchemaRegistryClientusing the specified configuration.static Optional<io.confluent.kafka.schemaregistry.client.SchemaRegistryClient>createSchemaRegistryClient(Map<String, Object> kafkaProperties) Creates a newSchemaRegistryClientusing the specified configuration ifAbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIGis configured.static Optional<HasTopicHooks.TopicHook>createTopicHook(AppConfiguration<?> configuration) Create a hook that cleans up schemas associated with a topic.static Optional<HasTopicHooks.TopicHook>createTopicHook(Map<String, Object> kafkaProperties) Create a hook that cleans up schemas associated with a topic.
-
Method Details
-
createSchemaRegistryClient
public static Optional<io.confluent.kafka.schemaregistry.client.SchemaRegistryClient> createSchemaRegistryClient(Map<String, Object> kafkaProperties) Creates a newSchemaRegistryClientusing the specified configuration ifAbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIGis configured.- Parameters:
kafkaProperties- properties for creatingSchemaRegistryClient- Returns:
SchemaRegistryClientifAbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIGis configured- See Also:
-
createSchemaRegistryClient
public static io.confluent.kafka.schemaregistry.client.SchemaRegistryClient createSchemaRegistryClient(@NonNull @NonNull Map<String, Object> configs, @NonNull @NonNull String schemaRegistryUrl) Creates a newSchemaRegistryClientusing the specified configuration.- Parameters:
configs- properties passed toSchemaRegistryClientFactory.newClient(String, int, List, Map, Map)schemaRegistryUrl- URL of schema registry- Returns:
SchemaRegistryClient
-
createTopicHook
Create a hook that cleans up schemas associated with a topic. It is expected that all necessary properties to create aSchemaRegistryClientare part ofkafkaProperties.- Parameters:
kafkaProperties- Kafka properties to create hook from- Returns:
- hook that cleans up schemas associated with a topic
- See Also:
-
createTopicHook
Create a hook that cleans up schemas associated with a topic. It is expected that all necessary properties to create aSchemaRegistryClientare part ofAppConfiguration.getKafkaProperties().- Parameters:
configuration- Configuration to create hook from- Returns:
- hook that cleans up schemas associated with a topic
- See Also:
-