Class GlueSchemaRegistryDeserializationFacade

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class GlueSchemaRegistryDeserializationFacade
    extends Object
    implements Closeable
    Protocol agnostic AWS Generic de-serializer
    • Field Detail

      • cache

        protected com.google.common.cache.LoadingCache<UUID,​Schema> cache
    • Constructor Detail

      • GlueSchemaRegistryDeserializationFacade

        public GlueSchemaRegistryDeserializationFacade​(Map<String,​?> configs,
                                                       Properties properties,
                                                       @NonNull
                                                       @NonNull software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialProvider,
                                                       AWSSchemaRegistryClient schemaRegistryClient)
        Constructor accepting various dependencies.
        Parameters:
        configs - configuration map
        properties - configuration properties
        credentialProvider - credentials provider for integrating with schema registry service
        schemaRegistryClient - schema registry client for communicating with schema registry service
      • GlueSchemaRegistryDeserializationFacade

        public GlueSchemaRegistryDeserializationFacade​(@NonNull
                                                       @NonNull GlueSchemaRegistryConfiguration configuration,
                                                       @NonNull
                                                       @NonNull software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider)
    • Method Detail

      • overrideUserAgentApp

        public void overrideUserAgentApp​(String name)
        Method to override user-agent app name for the de-serializer. This overrides the previously set value in GlueSchemaRegistryConfiguration.
        Parameters:
        name - AppName
      • getSchemaDefinition

        public String getSchemaDefinition​(@NonNull
                                          @NonNull ByteBuffer buffer)
        Fetches the schema definition for the serialized data.
        Parameters:
        buffer - data for which schema definition is needed as ByteBuffer
        Returns:
        schema definition
        Throws:
        GlueSchemaRegistryIncompatibleDataException - when data is incompatible with schema registry
      • getActualData

        public byte[] getActualData​(byte[] data)
      • getSchema

        public Schema getSchema​(@NonNull
                                @lombok.NonNull byte[] data)
      • getSchemaDefinition

        public String getSchemaDefinition​(@NonNull
                                          @lombok.NonNull byte[] data)
        Fetches the schema definition for a the serialized data.
        Parameters:
        data - data for which schema definition is needed as byte array
        Returns:
        schema for the passed data
        Throws:
        GlueSchemaRegistryIncompatibleDataException - when data is incompatible with schema registry
      • deserialize

        public Object deserialize​(@NonNull
                                  @NonNull AWSDeserializerInput deserializerInput)
                           throws AWSSchemaRegistryException
        De-serializes the given data and returns an Object. Accepts encapsulated deserializer input.
        Parameters:
        deserializerInput - Input data object for deserializer
        Returns:
        de-serialized object instance
        Throws:
        AWSSchemaRegistryException - Exception during de-serialization
      • canDeserialize

        public boolean canDeserialize​(byte[] data)
        Returns if the given data array can be deserialized.
        Parameters:
        data - byte[] of data.
        Returns:
        boolean.
      • close

        public void close()
        Resource clean up for Closeable. This method internally shuts down the background thread for publishing cloud watch metrics. After this is called, a new instance of this class should be created to enable the metrics publishing feature.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable