GenericSerializer

fs2.kafka.GenericSerializer
See theGenericSerializer companion class

Functional composable Kafka key- and record serializer with support for effect types.

Attributes

Companion
class
Source
Serializer.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[F[_], A](implicit serializer: Serializer[F, A]): Serializer[F, A]

Attributes

Source
Serializer.scala
def apply[F[_]](implicit F: Sync[F]): Serializer[F, Array[Byte]]

Alias for Serializer#identity.

Alias for Serializer#identity.

Attributes

Source
Serializer.scala
def asNull[F[_], A](implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer which serializes all values of type A as null.

Creates a new Serializer which serializes all values of type A as null.

Attributes

Source
Serializer.scala
def const[F[_], A](bytes: Array[Byte])(implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer which serializes all values of type A to the specified bytes.

Creates a new Serializer which serializes all values of type A to the specified bytes.

Attributes

Source
Serializer.scala
def delegate[F[_], A](serializer: Serializer[A])(implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer which delegates serialization to the specified Kafka Serializer.

Creates a new Serializer which delegates serialization to the specified Kafka Serializer. Note the close and configure functions won't be called for the delegate.

It is assumed the delegate serialize function is pure. If it's not pure, then use suspend after delegate, so the impure behaviours can be captured properly.

Attributes

Source
Serializer.scala
def empty[F[_], A](implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer which serializes all values of type A as the empty Array[Byte].

Creates a new Serializer which serializes all values of type A as the empty Array[Byte].

Attributes

Source
Serializer.scala
def fail[F[_], A](e: Throwable)(implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer which always fails serialization with the specified exception e.

Creates a new Serializer which always fails serialization with the specified exception e.

Attributes

Source
Serializer.scala
def failWith[F[_], A](message: String)(implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer which always fails serialization with a SerializationException using the specified message.

Creates a new Serializer which always fails serialization with a SerializationException using the specified message.

Attributes

Source
Serializer.scala
def headers[F[_], A](f: Headers => Serializer[F, A])(implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer which can use different Serializers depending on the record headers.

Creates a new Serializer which can use different Serializers depending on the record headers.

Attributes

Source
Serializer.scala
def instance[F[_], A](f: (String, Headers, A) => F[Array[Byte]])(implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer from the specified function.

Creates a new Serializer from the specified function. Use lift instead if the serializer doesn't need access to the Kafka topic name or record headers.

Attributes

Source
Serializer.scala
def lift[F[_], A](f: A => F[Array[Byte]])(implicit F: Sync[F]): Serializer[F, A]

Creates a new Serializer from the specified function, ignoring to which Kafka topic the bytes are going to be sent and any record headers.

Creates a new Serializer from the specified function, ignoring to which Kafka topic the bytes are going to be sent and any record headers. Use instance instead if the serializer needs access to the Kafka topic name or the record headers.

Attributes

Source
Serializer.scala
def string[F[_]](charset: Charset)(implicit F: Sync[F]): Serializer[F, String]

Creates a new Serializer which serializes String values using the specified Charset.

Creates a new Serializer which serializes String values using the specified Charset. Note that the default String serializer uses UTF-8.

Attributes

Source
Serializer.scala
def topic[T <: KeyOrValue, F[_], A](f: PartialFunction[String, GenericSerializer[T, F, A]])(implicit F: Sync[F]): GenericSerializer[T, F, A]

Creates a new Serializer which can use different Serializers depending on the Kafka topic name to which the bytes are going to be sent.

Creates a new Serializer which can use different Serializers depending on the Kafka topic name to which the bytes are going to be sent.

Attributes

Source
Serializer.scala
def uuid[F[_]](charset: Charset)(implicit F: Sync[F]): Serializer[F, UUID]

Creates a new Serializer which serializes UUID values as Strings with the specified Charset.

Creates a new Serializer which serializes UUID values as Strings with the specified Charset. Note that the default UUID serializer uses UTF-8.

Attributes

Source
Serializer.scala

Implicits

Implicits

implicit def contravariant[T <: KeyOrValue, F[_]]: Contravariant[[_] =>> GenericSerializer[T, F, _$25]]

Attributes

Source
Serializer.scala
implicit def double[F[_]](implicit F: Sync[F]): Serializer[F, Double]

Attributes

Source
Serializer.scala
implicit def float[F[_]](implicit F: Sync[F]): Serializer[F, Float]

Attributes

Source
Serializer.scala
implicit def identity[F[_]](implicit F: Sync[F]): Serializer[F, Array[Byte]]

The identity Serializer, which does not perform any kind of serialization, simply using the input bytes as the output.

The identity Serializer, which does not perform any kind of serialization, simply using the input bytes as the output.

Attributes

Source
Serializer.scala
implicit def int[F[_]](implicit F: Sync[F]): Serializer[F, Int]

Attributes

Source
Serializer.scala
implicit def long[F[_]](implicit F: Sync[F]): Serializer[F, Long]

Attributes

Source
Serializer.scala
implicit def option[T <: KeyOrValue, F[_], A](implicit serializer: GenericSerializer[T, F, A]): GenericSerializer[T, F, Option[A]]

The option Serializer serializes None as null, and serializes Some values using the serializer for type A.

The option Serializer serializes None as null, and serializes Some values using the serializer for type A.

Attributes

Source
Serializer.scala
implicit def resource[T <: KeyOrValue, F[_], A](implicit ser: GenericSerializer[T, F, A]): Resource[F, GenericSerializer[T, F, A]]

Attributes

Source
Serializer.scala
implicit def short[F[_]](implicit F: Sync[F]): Serializer[F, Short]

Attributes

Source
Serializer.scala
implicit def string[F[_]](implicit F: Sync[F]): Serializer[F, String]

Attributes

Source
Serializer.scala
implicit def unit[F[_]](implicit F: Sync[F]): Serializer[F, Unit]

Attributes

Source
Serializer.scala
implicit def uuid[F[_]](implicit F: Sync[F]): Serializer[F, UUID]

Attributes

Source
Serializer.scala