scoquelin / kafka-streams-scalapb-serde

ScalaPB wrapper for Kafka Streams protobuf serde


CI codecov


You have generated ScalaPB classes for your proto files.

You want to use Kafka or Kafka Streams and possibly leverage Schema Registry.

The official Kafka protobuf serdes accepts messages that extends Java to be serialized/deserialized.

This project is - on purpose - a very thin layer on top of official Kafka protobuf serdes will allow you to provide scalapb.GeneratedMessage and will take care of the rest for you while - hopefully - remaining compatible with future versions of official serdes without much effort.


First you need to enable Java conversions in scalapb to allow bridging from Scala PB to Java PB classes.


In your build.sbt :

PB.targets in Compile := Seq( -> (sourceManaged in Compile).value,
  scalapb.gen(javaConversions=true) -> (sourceManaged in Compile).value


Assuming you're using :


  generateProtoTasks {
    all().each { task ->
      task.plugins {
          scalapb {
            option 'java_conversions'


Check the tests 😈