AvroSerializer

fs2.kafka.vulcan.AvroSerializer
See theAvroSerializer companion object
sealed abstract class AvroSerializer[F[_]]

Creates serializers for record keys and values with Vulcan Codecs.

Serializers use the Confluent wire format, which is the Avro binary prefixed by a zero magic byte and the 4-byte schema id.

By default, the codec schema is registered under the subject decided by the subjectNameStrategy, unless autoRegisterSchemas is set to false, in which case the schema has to be pre-registered.

Use withLatestVersion or withSchemaId to write values using a schema different from the codec schema. To write schema identifiers in record headers, use withSchemaIdHeaders.

Use AvroSerializer.default to create an instance.

Attributes

Companion
object
Source
AvroSerializer.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

Whether to register codec schemas which are not already registered.

Whether to register codec schemas which are not already registered.

If false, schemas are looked up, and serialization fails if they are not already registered.

Note that using either withLatestVersion or withSchemaId means auto registration gets disabled.

The default value is true.

Attributes

Source
AvroSerializer.scala
def forKey[A](implicit codec: Codec[A]): Resource[F, KeySerializer[F, A]]

Returns a serializer for record keys, failing if the codec schema is invalid.

Returns a serializer for record keys, failing if the codec schema is invalid.

Attributes

Source
AvroSerializer.scala
def forValue[A](implicit codec: Codec[A]): Resource[F, ValueSerializer[F, A]]

Returns a serializer for record values, failing if the codec schema is invalid.

Returns a serializer for record values, failing if the codec schema is invalid.

Attributes

Source
AvroSerializer.scala

Whether the schema registry should normalize schemas when registering and looking them up, so that semantically equivalent schemas are the same schema.

Whether the schema registry should normalize schemas when registering and looking them up, so that semantically equivalent schemas are the same schema.

The default value is false.

Attributes

Source
AvroSerializer.scala
def registerKeySchema[A](topic: String)(implicit codec: Codec[A]): F[SchemaId]

Registers the codec schema under the subject for record keys of the topic, decided by the subjectNameStrategy, unless already registered, and returns the schema id.

Registers the codec schema under the subject for record keys of the topic, decided by the subjectNameStrategy, unless already registered, and returns the schema id.

Attributes

Source
AvroSerializer.scala
def registerSchema[A](subject: SubjectName)(implicit codec: Codec[A]): F[SchemaId]

Registers the codec schema under the specified subject, unless already registered, and returns the schema id.

Registers the codec schema under the specified subject, unless already registered, and returns the schema id.

Attributes

Source
AvroSerializer.scala
def registerValueSchema[A](topic: String)(implicit codec: Codec[A]): F[SchemaId]

Registers the codec schema under the subject for record values of the topic, decided by the subjectNameStrategy, unless already registered, and returns the schema id.

Registers the codec schema under the subject for record values of the topic, decided by the subjectNameStrategy, unless already registered, and returns the schema id.

Attributes

Source
AvroSerializer.scala

Whether to write schema identifiers in record headers, rather than before the Avro binary, like the Confluent HeaderSchemaIdSerializer.

Whether to write schema identifiers in record headers, rather than before the Avro binary, like the Confluent HeaderSchemaIdSerializer. The schema GUID is written in the key_schema_id or value_schema_id header, which requires a schema registry supporting schema GUIDs, like Confluent Schema Registry 8.0 and later.

The default value is false.

Attributes

Source
AvroSerializer.scala

The client for the schema registry where schemas are registered or looked up.

The client for the schema registry where schemas are registered or looked up.

Attributes

Source
AvroSerializer.scala

The subject name strategy with which schemas are registered and looked up.

The subject name strategy with which schemas are registered and looked up.

The default value is SubjectNameStrategy.TopicName.

Attributes

Source
AvroSerializer.scala
def withAutoRegisterSchemas(autoRegisterSchemas: Boolean): AvroSerializer[F]

Returns a new AvroSerializer writing values using the schema of the codec, which is registered automatically if autoRegisterSchemas is true, and looked up otherwise.

Returns a new AvroSerializer writing values using the schema of the codec, which is registered automatically if autoRegisterSchemas is true, and looked up otherwise.

Attributes

Source
AvroSerializer.scala

Returns a new AvroSerializer writing values using the latest version of the subject, rather than the schema of the codec, like use.latest.version for the Confluent serializers.

Returns a new AvroSerializer writing values using the latest version of the subject, rather than the schema of the codec, like use.latest.version for the Confluent serializers. Schemas are not registered automatically.

Values are resolved into the latest version following Avro's schema resolution, so fields missing in the codec use the defaults of the latest version. Serialization fails if values of the codec cannot be written using the latest version. Latest versions are cached by the schema registry client, which can expire them using withLatestCacheExpiry.

Attributes

Source
AvroSerializer.scala
def withNormalizeSchemas(normalizeSchemas: Boolean): AvroSerializer[F]

Returns a new AvroSerializer with the specified normalizeSchemas setting.

Returns a new AvroSerializer with the specified normalizeSchemas setting.

Attributes

Source
AvroSerializer.scala

Returns a new AvroSerializer writing values using the schema with the specified id, rather than the schema of the codec, like use.schema.id for the Confluent serializers.

Returns a new AvroSerializer writing values using the schema with the specified id, rather than the schema of the codec, like use.schema.id for the Confluent serializers. Schemas are not registered automatically.

Values are resolved into the schema following Avro's schema resolution, and serialization fails if values of the codec cannot be written using the schema.

Attributes

Source
AvroSerializer.scala
def withSchemaIdHeaders(schemaIdHeaders: Boolean): AvroSerializer[F]

Returns a new AvroSerializer with the specified schemaIdHeaders setting.

Returns a new AvroSerializer with the specified schemaIdHeaders setting.

Attributes

Source
AvroSerializer.scala

Returns a new AvroSerializer with the specified subjectNameStrategy.

Returns a new AvroSerializer with the specified subjectNameStrategy.

Attributes

Source
AvroSerializer.scala