Class AbstractKafkaProtobufSerializer<T extends com.google.protobuf.Message>

java.lang.Object
io.confluent.kafka.serializers.AbstractKafkaSchemaSerDe
io.confluent.kafka.serializers.protobuf.AbstractKafkaProtobufSerializer<T>
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
KafkaProtobufSerializer

public abstract class AbstractKafkaProtobufSerializer<T extends com.google.protobuf.Message> extends AbstractKafkaSchemaSerDe
  • Field Details

    • normalizeSchema

      protected boolean normalizeSchema
    • autoRegisterSchema

      protected boolean autoRegisterSchema
    • propagateSchemaTags

      protected boolean propagateSchemaTags
    • onlyLookupReferencesBySchema

      protected boolean onlyLookupReferencesBySchema
    • useSchemaId

      protected int useSchemaId
    • idCompatStrict

      protected boolean idCompatStrict
    • latestCompatStrict

      protected boolean latestCompatStrict
    • schemaFormat

      protected String schemaFormat
    • skipKnownTypes

      protected boolean skipKnownTypes
    • referenceSubjectNameStrategy

      protected ReferenceSubjectNameStrategy referenceSubjectNameStrategy
  • Constructor Details

    • AbstractKafkaProtobufSerializer

      public AbstractKafkaProtobufSerializer()
  • Method Details

    • configure

      protected void configure(KafkaProtobufSerializerConfig config)
    • serializerConfig

      protected KafkaProtobufSerializerConfig serializerConfig(Map<String,?> props)
    • serializeImpl

      protected byte[] serializeImpl(String subject, String topic, boolean isKey, T object, ProtobufSchema schema) throws org.apache.kafka.common.errors.SerializationException, org.apache.kafka.common.errors.InvalidConfigurationException
      Throws:
      org.apache.kafka.common.errors.SerializationException
      org.apache.kafka.common.errors.InvalidConfigurationException
    • serializeImpl

      protected byte[] serializeImpl(String subject, String topic, boolean isKey, org.apache.kafka.common.header.Headers headers, T object, ProtobufSchema schema) throws org.apache.kafka.common.errors.SerializationException, org.apache.kafka.common.errors.InvalidConfigurationException
      Throws:
      org.apache.kafka.common.errors.SerializationException
      org.apache.kafka.common.errors.InvalidConfigurationException
    • resolveDependencies

      public static ProtobufSchema resolveDependencies(SchemaRegistryClient schemaRegistry, boolean autoRegisterSchema, boolean useLatestVersion, boolean latestCompatStrict, Map<AbstractKafkaSchemaSerDe.SubjectSchema,AbstractKafkaSchemaSerDe.ExtendedSchema> latestVersions, ReferenceSubjectNameStrategy strategy, String topic, boolean isKey, ProtobufSchema schema) throws IOException, RestClientException
      Resolve schema dependencies recursively.
      Parameters:
      schemaRegistry - schema registry client
      autoRegisterSchema - whether to automatically register schemas
      useLatestVersion - whether to use the latest subject version for serialization
      latestCompatStrict - whether to check that the latest subject version is backward compatible with the schema of the object
      latestVersions - an optional cache of latest subject versions, may be null
      strategy - the strategy for determining the subject name for a reference
      topic - the topic
      isKey - whether the object is the record key
      schema - the schema
      Returns:
      the schema with resolved dependencies
      Throws:
      IOException
      RestClientException
    • resolveDependencies

      public static ProtobufSchema resolveDependencies(SchemaRegistryClient schemaRegistry, boolean autoRegisterSchema, boolean useLatestVersion, boolean latestCompatStrict, Map<AbstractKafkaSchemaSerDe.SubjectSchema,AbstractKafkaSchemaSerDe.ExtendedSchema> latestVersions, boolean skipKnownTypes, ReferenceSubjectNameStrategy strategy, String topic, boolean isKey, ProtobufSchema schema) throws IOException, RestClientException
      Resolve schema dependencies recursively.
      Parameters:
      schemaRegistry - schema registry client
      autoRegisterSchema - whether to automatically register schemas
      useLatestVersion - whether to use the latest subject version for serialization
      latestCompatStrict - whether to check that the latest subject version is backward compatible with the schema of the object
      latestVersions - an optional cache of latest subject versions, may be null
      skipKnownTypes - whether to skip known types when resolving schema dependencies
      strategy - the strategy for determining the subject name for a reference
      topic - the topic
      isKey - whether the object is the record key
      schema - the schema
      Returns:
      the schema with resolved dependencies
      Throws:
      IOException
      RestClientException
    • resolveDependencies

      public static ProtobufSchema resolveDependencies(SchemaRegistryClient schemaRegistry, boolean normalizeSchema, boolean autoRegisterSchema, boolean useLatestVersion, boolean latestCompatStrict, Map<AbstractKafkaSchemaSerDe.SubjectSchema,AbstractKafkaSchemaSerDe.ExtendedSchema> latestVersions, boolean skipKnownTypes, ReferenceSubjectNameStrategy strategy, String topic, boolean isKey, ProtobufSchema schema) throws IOException, RestClientException
      Throws:
      IOException
      RestClientException
    • resolveDependencies

      public static ProtobufSchema resolveDependencies(SchemaRegistryClient schemaRegistry, boolean normalizeSchema, boolean autoRegisterSchema, boolean propagateSchemaTags, boolean useLatestVersion, boolean latestCompatStrict, Map<AbstractKafkaSchemaSerDe.SubjectSchema,AbstractKafkaSchemaSerDe.ExtendedSchema> latestVersions, boolean skipKnownTypes, ReferenceSubjectNameStrategy strategy, String topic, boolean isKey, ProtobufSchema schema) throws IOException, RestClientException
      Resolve schema dependencies recursively.
      Parameters:
      schemaRegistry - schema registry client
      normalizeSchema - whether to normalized the schema
      autoRegisterSchema - whether to automatically register schemas
      propagateSchemaTags - whether to propagate tags during registration
      useLatestVersion - whether to use the latest subject version for serialization
      latestCompatStrict - whether to check that the latest subject version is backward compatible with the schema of the object
      latestVersions - an optional cache of latest subject versions, may be null
      skipKnownTypes - whether to skip known types when resolving schema dependencies
      strategy - the strategy for determining the subject name for a reference
      topic - the topic
      isKey - whether the object is the record key
      schema - the schema
      Returns:
      the schema with resolved dependencies
      Throws:
      IOException
      RestClientException