Class AssociationConfigParser
java.lang.Object
io.confluent.kafka.odyssey.AssociationConfigParser
Parser for Odyssey association configurations
Association configs:
- confluent.key.association - JSON payload for key schema association
- confluent.value.association - JSON payload for value schema association
-
Method Summary
Modifier and TypeMethodDescriptionstatic ParsedAssociationsextractAssociations(Optional<String> keyPayload, Optional<String> valuePayload) Parses the payloads a request supplied for the two association configs.static ParsedAssociationsextractAssociations(org.apache.kafka.common.message.CreateTopicsRequestData.CreatableTopic topic) Extracts association configurations from a topic.static voidfilterOdysseyConfigsFromTopics(org.apache.kafka.common.message.CreateTopicsRequestData.CreatableTopicCollection topics) Filters out Odyssey association configs from CreatableTopicCollection in-place.filterOutOdysseyConfigs(Map<String, String> configs) Filters out Odyssey association configs from a config map.static booleanhasAssociationConfigs(org.apache.kafka.common.message.CreateTopicsRequestData.CreatableTopic topic) Checks whether the topic carries an association in either place one can arrive: as an inline topic config, or as a tagged bytes field once the payload exceeds the inline string limit.
-
Method Details
-
hasAssociationConfigs
public static boolean hasAssociationConfigs(org.apache.kafka.common.message.CreateTopicsRequestData.CreatableTopic topic) Checks whether the topic carries an association in either place one can arrive: as an inline topic config, or as a tagged bytes field once the payload exceeds the inline string limit. A large payload leaves no inline config behind, so checking the configs alone would miss it. -
extractAssociations
public static ParsedAssociations extractAssociations(org.apache.kafka.common.message.CreateTopicsRequestData.CreatableTopic topic) Extracts association configurations from a topic. A payload arrives either as an inline topic config or, once it exceeds the inline string limit, as the topic's tagged bytes field.- Parameters:
topic- The topic to read associations from- Returns:
- ParsedAssociations with optional key and value configs
- Throws:
org.apache.kafka.common.config.ConfigException- if an association is set both inline and as a tagged payload, or if a supplied payload is unparseable or names an invalid lifecycle
-
extractAssociations
public static ParsedAssociations extractAssociations(Optional<String> keyPayload, Optional<String> valuePayload) Parses the payloads a request supplied for the two association configs. An empty argument means that config was not supplied; a supplied payload that is blank parses to an association carrying only its type, leaving Schema Registry to reject it naming the field that is missing.- Throws:
org.apache.kafka.common.config.ConfigException- if a supplied payload is unparseable or names an invalid lifecycle
-
filterOutOdysseyConfigs
-
filterOdysseyConfigsFromTopics
public static void filterOdysseyConfigsFromTopics(org.apache.kafka.common.message.CreateTopicsRequestData.CreatableTopicCollection topics) Filters out Odyssey association configs from CreatableTopicCollection in-place.
-