Schema Registry SerDes reference

Configuration properties for Schema Registry SerDes, covering the Avro serializer and deserializer, JSON serializer and deserializer, and their embedded SchemaRegistryClient.

Schema Registry provides a SerDes library, distributed as the schema-registry-serdes Maven artifact (com.hortonworks.registries:schema-registry-serdes). The library provides Kafka serializer and deserializer implementations that integrate schema management directly into the Kafka producer and consumer pipeline. When a producer serializes a message, the library registers the schema with Schema Registry if it does not already exist. When a consumer deserializes a message, the library retrieves the schema for that version from Schema Registry and uses it to decode the payload. The library handles all schema lookups transparently through an embedded SchemaRegistryClient. The library provides the following SerDes classes:

  • KafkaAvroSerializer – Kafka serializer for Avro-encoded messages.
  • KafkaAvroDeserializer – Kafka deserializer for Avro-encoded messages.
  • KafkaJsonSerializer – Kafka serializer for JSON-encoded messages.
  • KafkaJsonDeserializer – Kafka deserializer for JSON-encoded messages.

All four SerDes classes use an embedded SchemaRegistryClient for Schema Registry communication. You configure the client by including SchemaRegistryClient properties in the same configuration as the SerDes class.

SchemaRegistryClient properties reference

Properties for configuring the SchemaRegistryClient (com.hortonworks.registries.schemaregistry.client.SchemaRegistryClient), covering connection endpoints, authentication, TLS, and retry behavior.

Table 1. SchemaRegistryClient properties
Property Name Description Type Default Value
schema.registry.url The URL of the Schema Registry server which this client connects to. String http://localhost:9090/api/v1
schema.registry.client.local.jars.path The local directory path to which downloaded JARs are copied to. String /tmp/schema-registry/local-jars
schema.registry.client.class.loader.cache.size The maximum size of the classloader cache. Int 1024
schema.registry.client.class.loader.cache.expiry.interval.secs The expiry interval (in seconds) of an entry in the classloader cache. Int 3600 sec
schema.registry.client.schema.version.cache.size The maximum size of schema text cache. Int 1024
schema.registry.client.schema.version.cache.expiry.interval.secs The expiry interval (in seconds) of an entry in schema version cache. Int 300 sec
schema.registry.client.schema.metadata.cache.size Maximum size of schema metadata cache. Int 1024
schema.registry.client.schema.metadata.cache.expiry.interval.secs Expiry interval (in seconds) of an entry in schema metadata cache. Int 300 sec
schema.registry.client.schema.text.cache.size Maximum size of schema text cache. Int 1024
schema.registry.client.schema.text.cache.expiry.interval.secs Expiry interval (in seconds) of an entry in schema text cache. Int 300 sec
schema.registry.client.url.selector Schema Registry URL selector class. String com.hortonworks.registries.schemaregistry.client.FailoverUrlSelector
sasl.jaas.config Schema Registry Dynamic JAAS configuration for SASL connection. String null
schema.registry.auth.username Username for basic authentication. String null
schema.registry.auth.password Password for basic authentication. String null
schema.registry.hash.function Hashing algorithm for generating schema fingerprints. String MD5
schema.registry.auth.type The type of authentication the client should use. If the value is oauth2, it will be configured for oauth login, otherwise it will use Kerberos. String kerberos
schema.registry.oauth.client.id Client ID for OAuth server in case of oauth login. String empty
schema.registry.oauth.secret Secret for OAuth server in case of oauth login. String empty
schema.registry.oauth.server.url OAuth server URL in case of oauth login. String empty
schema.registry.oauth.scope OAuth scope in case of oauth login. String empty
schema.registry.oauth.request.method HTTP method for requesting the oauth token. String post
trustStoreType Format of the truststore used to validate the TLS certificate of the OAuth2 token endpoint. Only applicable when schema.registry.auth.type=oauth2 and the token endpoint uses HTTPS with a certificate that is not trusted by the JVM's default truststore. String null (uses JVM default)
trustStorePath Absolute or relative file path to the truststore for validating the TLS certificate of the OAuth2 token endpoint. Only applicable when schema.registry.auth.type=oauth2 and the token endpoint uses HTTPS with a certificate that is not trusted by the JVM's default truststore. String null (uses JVM default cacerts)
trustStorePassword Password required to access the truststore file specified in trustStorePath. Only applicable when schema.registry.auth.type=oauth2. String null
trustStoreProvider Name of the Java security provider for the truststore used by the OAuth2 token endpoint HTTP client. Only applicable when schema.registry.auth.type=oauth2. String null (uses default provider)
trustManagerFactoryAlgorithm Algorithm used by the TrustManagerFactory for the OAuth2 token endpoint HTTP client. Only applicable when schema.registry.auth.type=oauth2. This is an advanced property that rarely needs to be configured. String null (uses default algorithm)
trustManagerFactoryProvider Provider name for the TrustManagerFactory for the OAuth2 token endpoint HTTP client. Only applicable when schema.registry.auth.type=oauth2. This is an advanced property that rarely needs to be configured. String null (uses default provider)
keyStorePath Absolute or relative file path to the keystore used for mutual TLS (mTLS) authentication with the OAuth2 token endpoint. Only applicable when schema.registry.auth.type=oauth2 and the token endpoint requires client certificate authentication. String null (mTLS to token endpoint disabled)
keyStoreType Format of the keystore file specified in keyStorePath for the OAuth2 token endpoint HTTP client. Only applicable when schema.registry.auth.type=oauth2. String null (uses JVM default, typically "JKS")
keyStorePassword Password required to access the keystore file specified in keyStorePath for the OAuth2 token endpoint HTTP client. Only applicable when schema.registry.auth.type=oauth2. String null
keyStoreProvider Name of the Java security provider for the keystore used by the OAuth2 token endpoint HTTP client. Only applicable when schema.registry.auth.type=oauth2. String null (uses default provider)
keyManagerFactoryAlgorithm Algorithm used by the KeyManagerFactory for the OAuth2 token endpoint HTTP client. Only applicable when schema.registry.auth.type=oauth2. This is an advanced property that rarely needs to be configured. String null (uses default algorithm)
keyManagerFactoryProvider Provider name for the KeyManagerFactory for the OAuth2 token endpoint HTTP client. Only applicable when schema.registry.auth.type=oauth2. This is an advanced property that rarely needs to be configured. String null (uses default provider)
keyPassword Password for the private key within the keystore used for mTLS authentication with the OAuth2 token endpoint. Only needed if the key password differs from keyStorePassword. Only applicable when schema.registry.auth.type=oauth2. String null (uses keyStorePassword)
protocol The SSL/TLS protocol name used when connecting to the OAuth2 token endpoint. Only applicable when schema.registry.auth.type=oauth2. To set the protocol for connections to the Schema Registry server, use schema.registry.client.ssl.protocol instead. String null (uses JVM default)
connector.provider.class Classname of a Jersey connector provider. (For example: org.glassfish.jersey.apache.connector.ApacheConnectorProvider) Make sure the class is on classpath. If this is set, Backoff policy might need to be set to com.hortonworks.registries.schemaregistry.retry.policy.ExponentialBackoffPolicy. String empty
schema.registry.client.ssl.protocol The SSL/TLS protocol name used to create the SSLContext for connections to the Schema Registry server. Using generic protocol names like SSL or TLS allows the JVM to negotiate the best available protocol version. Specifying a specific version restricts the connection to that protocol. String null (uses JVM default)
schema.registry.client.ssl.hostnameVerifierClass Fully qualified class name of a custom HostnameVerifier implementation for validating server hostnames during the SSL handshake. String null (uses default HTTPS hostname verification)
schema.registry.client.ssl.keyStoreType Format of the client keystore file. String null (uses JVM default, typically "JKS")
schema.registry.client.ssl.keyStorePath Absolute or relative file path to the keystore containing the client's private key and certificate. Required for mutual TLS (mTLS) authentication. String null (client authentication disabled)
schema.registry.client.ssl.keyStorePassword Password required to access the keystore file specified in schema.registry.client.ssl.keyStorePath. String null
schema.registry.client.ssl.keyPassword Password for the client's private key within the keystore. Only needed if different from schema.registry.client.ssl.keyStorePassword. String null (uses schema.registry.client.ssl.keyStorePassword)
schema.registry.client.ssl.keyStoreProvider Name of the Java security provider for the keystore. String null (uses default provider)
schema.registry.client.ssl.keyManagerFactoryAlgorithm Algorithm used by the KeyManagerFactory for managing client authentication credentials. This is an advanced property that rarely needs to be configured. String null (uses default algorithm)
schema.registry.client.ssl.keyManagerFactoryProvider Provider name for the KeyManagerFactory for managing client authentication credentials. This is an advanced property that rarely needs to be configured. String null (uses default provider)
schema.registry.client.ssl.trustStoreType Format of the truststore file. Required for validating the server's certificate. String null (uses JVM default)
schema.registry.client.ssl.trustStorePath Absolute or relative file path to the truststore containing trusted CA certificates for validating the server's SSL certificate. String null (uses JVM's default cacerts)
schema.registry.client.ssl.trustStorePassword Password required to access the truststore file specified in schema.registry.client.ssl.trustStorePath. String null
schema.registry.client.ssl.trustStoreProvider Name of the Java security provider for the truststore. String null (uses default provider)
schema.registry.client.ssl.trustManagerFactoryAlgorithm Algorithm used by the TrustManagerFactory for managing server certificate validation. This is an advanced property that rarely needs to be configured. String null (uses default algorithm)
schema.registry.client.ssl.trustManagerFactoryProvider Provider name for the TrustManagerFactory for managing server certificate validation. This is an advanced property that rarely needs to be configured. String null (uses default provider)
schema.registry.client.retry.policy Expects a map containing the retry policy configuration. The map accepts a className key to specify the policy class and a config key for policy-specific properties. Both keys are optional. className defaults to ExponentialBackoffPolicy if omitted, and config uses policy defaults if omitted. For available policies and properties, see Retry policies and retry policy configuration properties. Object ExponentialBackoffPolicy with the following default properties:
sleepTimeMs=1000
maxAttempts=5
timeoutMs=90000
schema.registry.client.doAs The user principal to send requests on behalf of. When configured, the principal name is included in the doAs query parameter for every request. String empty

Retry policies and retry policy configuration properties

The schema.registry.client.retry.policy property expects a map containing the retry policy configuration. The map accepts a className key to specify the policy class and a config key for policy-specific properties. Both keys are optional. className defaults to ExponentialBackoffPolicy if omitted, and config uses policy defaults if omitted. The retry policy controls how the client handles failed requests to the Schema Registry server.

The following retry policies are available:
  • com.hortonworks.registries.schemaregistry.retry.policy.ExponentialBackoffPolicy – The default policy. Retries with exponentially increasing delays between attempts.

  • com.hortonworks.registries.schemaregistry.retry.policy.FixedTimeBackoffPolicy – Retries with a fixed delay between attempts.

  • com.hortonworks.registries.schemaregistry.retry.policy.NOOPBackoffPolicy – No retry attempts are made.

Example configuration in YAML
#...
schema.registry.client.retry.policy:
  className: [***POLICY CLASS***]
  config:
    sleepTimeMs: [***MILLISECONDS***]
    maxAttempts: [***ATTEMPT COUNT***]
    timeoutMs: [***TIMEOUT MILLISECONDS***]
Table 2. SchemaRegistryClient retry policy configuration properties
Property Name Description Type Default Value
sleepTimeMs The initial delay in milliseconds between retry attempts. For ExponentialBackoffPolicy, this value increases exponentially with each retry. Long ExponentialBackoffPolicy – 1000
FixedTimeBackoffPolicy – 1000
NOOPBackoffPolicy – 0
maxAttempts The maximum number of retry attempts before failing the request. Int ExponentialBackoffPolicy – 5
FixedTimeBackoffPolicy – 5
NOOPBackoffPolicy – 1
timeoutMs The total timeout in milliseconds for all retry attempts combined. The client will stop retrying once this timeout is exceeded, even if maxAttempts has not been reached. Long ExponentialBackoffPolicy – 90000
FixedTimeBackoffPolicy – 60000
NOOPBackoffPolicy – 0

KafkaAvroSerializer properties reference

Properties for configuring the KafkaAvroSerializer (com.hortonworks.registries.schemaregistry.serdes.avro.kafka.KafkaAvroSerializer) when producing Avro-encoded messages to Kafka using Schema Registry.

Property Name Description Type Default Value
schema.compatibility The default compatibility of the new schemas created by the serializer. For more information about the compatibility options, see the Compatibility policies documentation. String none (Registry default applies if omitted)
schema.group The default group of the new schemas created by the serializer. String kafka
schema.name.key.suffix The provided string will be appended to the end of the schema name created for record keys. The schema name is the topic name initially, so as a result, you will have topic name + provided suffix as schema name. String :k
schema.name.value.suffix The provided string will be appended to the end of the schema name created for record values. The schema name is the topic name initially, so as a result, you will have topic name + provided suffix as schema name. String null
null.passthrough.enabled If this is enabled, the serializer will return immediately with null value, without putting anything in the serialized output. Having null values can be important in compact topics. Having null as the latest value for a key indicates for Kafka that the corresponding key can be deleted during log compaction. Boolean false
logical.type.conversion.enabled If this is enabled, Avro record fields can be serialized that are instances of Java classes (BigDecimal, UUID, LocalDate, and so on) that can be serialized in Avro using logical types. For more information, see the Logical Types section in the official Avro documentation.

This does not have to be enabled if SpecificRecords are used as part of generated classes. SpecificDatumWriter is used for serializing SpecificRecord instances and that writer handles logical types automatically.

Boolean false
serdes.protocol.version The protocol version to be used. The available default registered protocols are the following:
  • CONFLUENT_VERSION_PROTOCOL = 0x0;
  • METADATA_ID_VERSION_PROTOCOL = 0x1;
  • VERSION_ID_AS_LONG_PROTOCOL = 0x2;
  • VERSION_ID_AS_INT_PROTOCOL = 0x3;
  • JSON_PROTOCOL = 0x4;
Byte 0x3

(VERSION_ID_AS_INT_PROTOCOL)

store.schema.version.id.in.header If this is set to true, the schema version ID will be stored in the record header instead of the value. Boolean false
key_schema_version_id_header_name If the schema of the record key is stored in the header, the header name can be configured. String key.schema.version.id
value_schema_version_id_header_name If the schema of the record value is stored in the header, the header name can be configured. String value.schema.version.id
schema.registry.auto.register.schemas Controls whether the serializer automatically registers a schema with Schema Registry if it does not already exist. When set to false, the serializer will fail if the schema has not been registered in advance. Boolean true

KafkaAvroDeserializer properties reference

Properties for configuring the KafkaAvroDeserializer (com.hortonworks.registries.schemaregistry.serdes.avro.kafka.KafkaAvroDeserializer) when consuming Avro-encoded messages from Kafka using Schema Registry.

Property Name Description Type Default Value
schemaregistry.reader.schema.versions This is for setting which version of the schema should be used for which topic.1 Map<String, Integer> Empty map
specific.avro.reader If this is enabled, SpecificDatumReader will be used for deserialization. Boolean false
logical.type.conversion.enabled If this is enabled, Avro record fields that have logical types can be deserialized directly into their corresponding Java classes (BigDecimal, UUID, LocalDate, and so on). If not enabled, the record field will be deserialized as raw type, without handling the logical type. In this case, probably the same logical type related conversion will be needed to get a valid value. If specific.avro.reader is set to true, this does not have any effect. Boolean false
key_schema_version_id_header_name If the schema of the record key is stored in the header, the header name can be configured. String key.schema.version.id
value_schema_version_id_header_name If the schema of the record value is stored in the header, the header name can be configured. String value.schema.version.id
schemaregistry.deserializer.schema.cache.size The maximum number of schemas the deserializer caches locally. Increasing this value reduces Schema Registry lookups for high-cardinality schema workloads. Integer 1024
schemaregistry.deserializer.schema.cache.expiry.secs The time in seconds after which a cached schema entry expires and is evicted from the local deserializer cache. Long 300
1 Example:
Map<String, Object> configs = new HashMap<>()
Map<String, Integer> readerVersions = new HashMap<>();
readerVersions.put("clicks", 2);
readerVersions.put("users", 1);
configs.put("schemaregistry.reader.schema.versions", readerVersions);

KafkaJsonSerializer properties reference

Properties for configuring the KafkaJsonSerializer (com.hortonworks.registries.schemaregistry.serdes.json.kafka.KafkaJsonSerializer) when producing JSON-encoded messages to Kafka using Schema Registry.

Property Name Description Type Default Value
schema.compatibility The default compatibility of the new schemas created by the serializer. For more information about the compatibility options, see the Compatibility policies documentation. String none (Registry default applies if omitted)
schema.group The default group of the new schemas created by the serializer. String kafka
schema.name.key.suffix The provided string will be appended to the end of the schema name created for record keys. The schema name is the topic name initially, so as a result, you will have topic name + provided suffix as schema name. String :k
schema.name.value.suffix The provided string will be appended to the end of the schema name created for record values. The schema name is the topic name initially, so as a result, you will have topic name + provided suffix as schema name. String null
store.schema.version.id.in.header If this is set to true, the schema version ID will be stored in the record header instead of the value. Boolean false
key_schema_version_id_header_name If the schema of the record key is stored in the header, the header name can be configured. String key.schema.version.id
value_schema_version_id_header_name If the schema of the record value is stored in the header, the header name can be configured. String value.schema.version.id
schema.registry.auto.register.schemas Controls whether the serializer automatically registers a schema with Schema Registry if it does not already exist. When set to false, the serializer will fail if the schema has not been registered in advance. Boolean true

KafkaJsonDeserializer properties reference

Properties for configuring the KafkaJsonDeserializer (com.hortonworks.registries.schemaregistry.serdes.json.kafka.KafkaJsonDeserializer) when consuming JSON-encoded messages from Kafka using Schema Registry.

Property Name Description Type Default Value
schemaregistry.reader.schema.versions This is for setting which version of the schema should be used for which topic.2 Map<String, Integer> Empty map
key_schema_version_id_header_name If the schema of the record key is stored in the header, the header name can be configured. String key.schema.version.id
value_schema_version_id_header_name If the schema of the record value is stored in the header, the header name can be configured. String value.schema.version.id
schemaregistry.deserializer.schema.cache.size The maximum number of schemas the deserializer caches locally. Increasing this value reduces Schema Registry lookups for high-cardinality schema workloads. Integer 1024
schemaregistry.deserializer.schema.cache.expiry.secs The time in seconds after which a cached schema entry expires and is evicted from the local deserializer cache. Long 300
2 Example:
Map<String, Object> configs = new HashMap<>()
Map<String, Integer> readerVersions = new HashMap<>();
readerVersions.put("clicks", 2);
readerVersions.put("users", 1);
configs.put("schemaregistry.reader.schema.versions", readerVersions);