GenericSerializer

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

Companion:
class
Source:
Serializer.scala
class Object
trait Matchable
class Any

Value members

Concrete methods

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

Alias for Serializer#identity.

Alias for Serializer#identity.

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.

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.

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. 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.

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.

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].

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.

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.

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.

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. Use lift instead if the serializer doesn't need access to the Kafka topic name or record headers.

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.

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. Use instance instead if the serializer needs access to the Kafka topic name or the 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.

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. Note that the default String serializer uses UTF-8.

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

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.

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. Note that the default UUID serializer uses UTF-8.

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

Source:
Serializer.scala

Implicits

Implicits

implicit def contravariant[T <: KeyOrValue, F[_]]: Contravariant[[_] =>> GenericSerializer[T, F, _$25]]
implicit def double[F[_]](implicit F: Sync[F]): Serializer[F, Double]
implicit def float[F[_]](implicit F: Sync[F]): Serializer[F, Float]
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.

Source:
Serializer.scala
implicit def int[F[_]](implicit F: Sync[F]): Serializer[F, Int]
implicit def long[F[_]](implicit F: Sync[F]): Serializer[F, Long]
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.

Source:
Serializer.scala
implicit def short[F[_]](implicit F: Sync[F]): Serializer[F, Short]
implicit def string[F[_]](implicit F: Sync[F]): Serializer[F, String]
implicit def unit[F[_]](implicit F: Sync[F]): Serializer[F, Unit]
implicit def uuid[F[_]](implicit F: Sync[F]): Serializer[F, UUID]