Package io.confluent.kafka.serializers
Class AbstractKafkaAvroDeserializer
java.lang.Object
io.confluent.kafka.serializers.AbstractKafkaSchemaSerDe
io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
KafkaAvroDecoder,KafkaAvroDeserializer
-
Nested Class Summary
Nested classes/interfaces inherited from class io.confluent.kafka.serializers.AbstractKafkaSchemaSerDe
AbstractKafkaSchemaSerDe.ExtendedSchema, AbstractKafkaSchemaSerDe.Migration, AbstractKafkaSchemaSerDe.SubjectSchema -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected org.apache.avro.Schemaprotected booleanFields inherited from class io.confluent.kafka.serializers.AbstractKafkaSchemaSerDe
config, configOriginals, contextNameStrategy, DEFAULT_CACHE_CAPACITY, enableRuleServiceLoader, isKey, keySchemaIdDeserializer, keySchemaIdSerializer, keySubjectNameStrategy, latestVersions, latestWithMetadata, metadata, ruleActions, ruleExecutors, schemaRegistry, ticker, useLatestVersion, useSchemaReflection, valueSchemaIdDeserializer, valueSchemaIdSerializer, valueSubjectNameStrategy -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigure(KafkaAvroDeserializerConfig config) protected voidconfigure(KafkaAvroDeserializerConfig config, Class<?> type) Sets properties for this deserializer without overriding the schema registry client itself.protected Objectdeserialize(byte[] payload) Deserializes the payload without including schema information for primitive types, maps, and arrays.protected Objectdeserialize(byte[] payload, org.apache.avro.Schema readerSchema) Just like single-parameter version but accepts an Avro schema to use for readingprotected Objectdeserialize(String topic, Boolean isKey, byte[] payload, org.apache.avro.Schema readerSchema) protected Objectdeserialize(String topic, Boolean isKey, org.apache.kafka.common.header.Headers headers, byte[] payload, org.apache.avro.Schema readerSchema) protected Objectdeserialize(org.apache.kafka.common.header.Headers headers, byte[] payload) protected Objectdeserialize(org.apache.kafka.common.header.Headers headers, byte[] payload, org.apache.avro.Schema readerSchema) protected KafkaAvroDeserializerConfigdeserializerConfig(Map<String, ?> props) protected KafkaAvroDeserializerConfigdeserializerConfig(Properties props) protected GenericContainerWithVersiondeserializeWithSchemaAndVersion(String topic, boolean isKey, byte[] payload) Deserializes the payload and includes schema information, with version information from the schema registry embedded in the schema.protected GenericContainerWithVersiondeserializeWithSchemaAndVersion(String topic, boolean isKey, org.apache.kafka.common.header.Headers headers, byte[] payload) protected org.apache.avro.io.DatumReader<?>getDatumReader(org.apache.avro.Schema writerSchema, org.apache.avro.Schema readerSchema) Methods inherited from class io.confluent.kafka.serializers.AbstractKafkaSchemaSerDe
clearKey, close, configureClientProperties, executeMigrations, executeRules, executeRules, executeRules, getById, getBySubjectAndId, getContextName, getContextName, getLatestWithMetadata, getMigrations, getOldSubjectName, getRuleActions, getRuleExecutors, getSchemaById, getSchemaBySchemaId, getSchemaBySubjectAndId, getSchemaRegistryClient, getSubjectName, isKey, key, latestVersionsCache, latestWithMetadataCache, lookupLatestVersion, lookupLatestVersion, lookupSchemaBySubjectAndId, postOp, register, register, register, registerWithResponse, schemaIdDeserializer, schemaIdSerializer, setKey, strategyUsesSchema, ticker, toKafkaException
-
Field Details
-
useSpecificAvroReader
protected boolean useSpecificAvroReader -
specificAvroReaderSchema
protected org.apache.avro.Schema specificAvroReaderSchema -
avroReflectionAllowNull
protected boolean avroReflectionAllowNull -
avroUseLogicalTypeConverters
protected boolean avroUseLogicalTypeConverters
-
-
Constructor Details
-
AbstractKafkaAvroDeserializer
public AbstractKafkaAvroDeserializer()
-
-
Method Details
-
configure
-
configure
Sets properties for this deserializer without overriding the schema registry client itself. Useful for testing, where a mock client is injected. -
deserializerConfig
-
deserializerConfig
-
deserialize
protected Object deserialize(byte[] payload) throws org.apache.kafka.common.errors.SerializationException Deserializes the payload without including schema information for primitive types, maps, and arrays. Just the resulting deserialized object is returned.This behavior is the norm for Decoders/Deserializers.
- Parameters:
payload- serialized data- Returns:
- the deserialized object
- Throws:
org.apache.kafka.common.errors.SerializationException
-
deserialize
protected Object deserialize(org.apache.kafka.common.header.Headers headers, byte[] payload) throws org.apache.kafka.common.errors.SerializationException - Throws:
org.apache.kafka.common.errors.SerializationException
-
deserialize
protected Object deserialize(byte[] payload, org.apache.avro.Schema readerSchema) throws org.apache.kafka.common.errors.SerializationException Just like single-parameter version but accepts an Avro schema to use for reading- Parameters:
payload- serialized datareaderSchema- schema to use for Avro read (optional, enables Avro projection)- Returns:
- the deserialized object
- Throws:
org.apache.kafka.common.errors.SerializationException
-
deserialize
protected Object deserialize(org.apache.kafka.common.header.Headers headers, byte[] payload, org.apache.avro.Schema readerSchema) throws org.apache.kafka.common.errors.SerializationException - Throws:
org.apache.kafka.common.errors.SerializationException
-
deserialize
protected Object deserialize(String topic, Boolean isKey, byte[] payload, org.apache.avro.Schema readerSchema) throws org.apache.kafka.common.errors.SerializationException - Throws:
org.apache.kafka.common.errors.SerializationException
-
deserialize
protected Object deserialize(String topic, Boolean isKey, org.apache.kafka.common.header.Headers headers, byte[] payload, org.apache.avro.Schema readerSchema) throws org.apache.kafka.common.errors.SerializationException - Throws:
org.apache.kafka.common.errors.SerializationException
-
deserializeWithSchemaAndVersion
protected GenericContainerWithVersion deserializeWithSchemaAndVersion(String topic, boolean isKey, byte[] payload) throws org.apache.kafka.common.errors.SerializationException, org.apache.kafka.common.errors.InvalidConfigurationException Deserializes the payload and includes schema information, with version information from the schema registry embedded in the schema.- Parameters:
payload- the serialized data- Returns:
- a GenericContainer with the schema and data, either as a
NonRecordContainer,GenericRecord, orSpecificRecord - Throws:
org.apache.kafka.common.errors.SerializationExceptionorg.apache.kafka.common.errors.InvalidConfigurationException
-
deserializeWithSchemaAndVersion
protected GenericContainerWithVersion deserializeWithSchemaAndVersion(String topic, boolean isKey, org.apache.kafka.common.header.Headers headers, byte[] payload) throws org.apache.kafka.common.errors.SerializationException, org.apache.kafka.common.errors.InvalidConfigurationException - Throws:
org.apache.kafka.common.errors.SerializationExceptionorg.apache.kafka.common.errors.InvalidConfigurationException
-
getDatumReader
protected org.apache.avro.io.DatumReader<?> getDatumReader(org.apache.avro.Schema writerSchema, org.apache.avro.Schema readerSchema) throws ExecutionException - Throws:
ExecutionException
-