Class SchemaByDefinitionFetcher


  • public class SchemaByDefinitionFetcher
    extends Object
    Fetches the schema version for the given schema definition optionally registering the schema if required.
    • Field Detail

      • schemaDefinitionToVersionCache

        @NonNull
        protected final @NonNull com.google.common.cache.LoadingCache<Schema,​UUID> schemaDefinitionToVersionCache
    • Method Detail

      • getORRegisterSchemaVersionId

        public UUID getORRegisterSchemaVersionId​(@NonNull
                                                 @NonNull String schemaDefinition,
                                                 @NonNull
                                                 @NonNull String schemaName,
                                                 @NonNull
                                                 @NonNull String dataFormat,
                                                 @NonNull
                                                 @NonNull Map<String,​String> metadata)
                                          throws AWSSchemaRegistryException
        Get Schema Version ID by following below steps :

        1) If schema version id exists in registry then get it from registry 2) If schema version id does not exist in registry then if auto registration is enabled then if schema exists but version doesn't exist then 2.1) Register schema version else if schema does not exist then 2.2) create schema and register schema version

        Parameters:
        schemaDefinition - Schema Definition
        schemaName - Schema Name
        dataFormat - Data Format
        metadata - metadata for schema version
        Returns:
        Schema Version ID
        Throws:
        AWSSchemaRegistryException - on any error while fetching the schema version ID