Class ProtobufKafkaSerializer<U extends com.google.protobuf.Message>
- java.lang.Object
-
- io.apicurio.registry.serde.SchemaResolverConfigurer<T,U>
-
- io.apicurio.registry.serde.AbstractKafkaSerDe<T,U>
-
- io.apicurio.registry.serde.AbstractKafkaSerializer<ProtobufSchema,U>
-
- io.apicurio.registry.serde.protobuf.ProtobufKafkaSerializer<U>
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.kafka.common.serialization.Serializer<U>
public class ProtobufKafkaSerializer<U extends com.google.protobuf.Message> extends AbstractKafkaSerializer<ProtobufSchema,U>
- Author:
- Ales Justin, Hiram Chirino, Fabian Martinez
-
-
Field Summary
-
Fields inherited from class io.apicurio.registry.serde.AbstractKafkaSerDe
headersHandler, idHandler, key, log, MAGIC_BYTE
-
Fields inherited from class io.apicurio.registry.serde.SchemaResolverConfigurer
schemaResolver
-
-
Constructor Summary
Constructors Constructor Description ProtobufKafkaSerializer()
ProtobufKafkaSerializer(io.apicurio.registry.rest.client.RegistryClient client)
ProtobufKafkaSerializer(io.apicurio.registry.rest.client.RegistryClient client, ArtifactResolverStrategy<ProtobufSchema> artifactResolverStrategy, SchemaResolver<ProtobufSchema,U> schemaResolver)
ProtobufKafkaSerializer(SchemaResolver<ProtobufSchema,U> schemaResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Map<String,?> configs, boolean isKey)
protected ParsedSchema<ProtobufSchema>
getSchemaFromData(U data)
SchemaParser<ProtobufSchema>
schemaParser()
protected void
serializeData(ParsedSchema<ProtobufSchema> schema, U data, OutputStream out)
protected void
serializeData(org.apache.kafka.common.header.Headers headers, ParsedSchema<ProtobufSchema> schema, U data, OutputStream out)
-
Methods inherited from class io.apicurio.registry.serde.AbstractKafkaSerializer
serialize, serialize
-
Methods inherited from class io.apicurio.registry.serde.AbstractKafkaSerDe
asLegacyId, configure, getByteBuffer, getIdHandler, isKey, reset, setHeadersHandler, setIdHandler
-
Methods inherited from class io.apicurio.registry.serde.SchemaResolverConfigurer
configure, getSchemaResolver, setSchemaResolver
-
-
-
-
Constructor Detail
-
ProtobufKafkaSerializer
public ProtobufKafkaSerializer()
-
ProtobufKafkaSerializer
public ProtobufKafkaSerializer(io.apicurio.registry.rest.client.RegistryClient client, ArtifactResolverStrategy<ProtobufSchema> artifactResolverStrategy, SchemaResolver<ProtobufSchema,U> schemaResolver)
-
ProtobufKafkaSerializer
public ProtobufKafkaSerializer(io.apicurio.registry.rest.client.RegistryClient client)
-
ProtobufKafkaSerializer
public ProtobufKafkaSerializer(SchemaResolver<ProtobufSchema,U> schemaResolver)
-
-
Method Detail
-
configure
public void configure(Map<String,?> configs, boolean isKey)
- Specified by:
configure
in interfaceorg.apache.kafka.common.serialization.Serializer<U extends com.google.protobuf.Message>
- Overrides:
configure
in classAbstractKafkaSerializer<ProtobufSchema,U extends com.google.protobuf.Message>
-
schemaParser
public SchemaParser<ProtobufSchema> schemaParser()
- Specified by:
schemaParser
in classAbstractKafkaSerDe<ProtobufSchema,U extends com.google.protobuf.Message>
- See Also:
AbstractKafkaSerDe.schemaParser()
-
getSchemaFromData
protected ParsedSchema<ProtobufSchema> getSchemaFromData(U data)
- Overrides:
getSchemaFromData
in classAbstractKafkaSerializer<ProtobufSchema,U extends com.google.protobuf.Message>
- See Also:
AbstractKafkaSerializer.getSchemaFromData(java.lang.Object)
-
serializeData
protected void serializeData(ParsedSchema<ProtobufSchema> schema, U data, OutputStream out) throws IOException
- Specified by:
serializeData
in classAbstractKafkaSerializer<ProtobufSchema,U extends com.google.protobuf.Message>
- Throws:
IOException
- See Also:
AbstractKafkaSerializer.serializeData(io.apicurio.registry.serde.ParsedSchema, java.lang.Object, java.io.OutputStream)
-
serializeData
protected void serializeData(org.apache.kafka.common.header.Headers headers, ParsedSchema<ProtobufSchema> schema, U data, OutputStream out) throws IOException
- Specified by:
serializeData
in classAbstractKafkaSerializer<ProtobufSchema,U extends com.google.protobuf.Message>
- Throws:
IOException
- See Also:
AbstractKafkaSerializer.serializeData(org.apache.kafka.common.header.Headers, io.apicurio.registry.serde.ParsedSchema, java.lang.Object, java.io.OutputStream)
-
-