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.SchemaRegistryClient
createSchemaRegistryClient
(@NonNull Map<String, Object> configs, @NonNull String schemaRegistryUrl) Creates a newSchemaRegistryClient
using the specified configuration.static Optional<io.confluent.kafka.schemaregistry.client.SchemaRegistryClient>
createSchemaRegistryClient
(Map<String, Object> kafkaProperties) Creates a newSchemaRegistryClient
using the specified configuration ifAbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG
is 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 newSchemaRegistryClient
using the specified configuration ifAbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG
is configured.- Parameters:
kafkaProperties
- properties for creatingSchemaRegistryClient
- Returns:
SchemaRegistryClient
ifAbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG
is 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 newSchemaRegistryClient
using 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 aSchemaRegistryClient
are 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 aSchemaRegistryClient
are part ofAppConfiguration.getKafkaProperties()
.- Parameters:
configuration
- Configuration to create hook from- Returns:
- hook that cleans up schemas associated with a topic
- See Also:
-