Home

Awesome

kafka-serde-scala

Join the chat at https://gitter.im/azhur/kafka-serde-scala Build Status

kafka-serde-scala provides implicit conversions from different type class Encoder/Decoder to kafka Serializer, Deserializer, Serde.

Following target libraries are supported:

Inspired by https://github.com/hseeberger/akka-http-json.

Installation

Maven Central

Add dependencies for the selected integration:

libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-avro4s" % version
)
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-circe" % version
)
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-jackson" % version
)
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-json4s" % version
)
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-jsoniter-scala" % version,
  "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniter_scala_version % Provided // required only in compile-time
)
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-play-json" % version
)
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-upickle" % version
)
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-scalapb" % version
)
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-zio-json" % version
)

Usage

Mix xxxSupport into your code which requires implicit Kafka Serde, Serializer or Deserializer, where xxx is the target library used for serialization, i.e: CirceSupport.

Provide your implicit type class instances and the magic will convert them to Kafka serializers:

For more info, please, take a look at unit tests and at kafka-serde-scala-example which is a kafka-streams (2.x) application with kafka-serde-scala usage.

Contribution

Feel free to contribute with creating PR or opening issues.

License

This code is open source software licensed under the Apache 2.0 License.