kafka-serde-avro4s


License

License

GroupId

GroupId

io.github.azhur
ArtifactId

ArtifactId

kafka-serde-avro4s_2.11
Last Version

Last Version

0.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

kafka-serde-avro4s
kafka-serde-avro4s
Project URL

Project URL

https://github.com/azhur/kafka-serde-scala
Project Organization

Project Organization

Artur Zhurat
Source Code Management

Source Code Management

https://github.com/azhur/kafka-serde-scala

Download kafka-serde-avro4s_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.azhur/kafka-serde-avro4s_2.11/ -->
<dependency>
    <groupId>io.github.azhur</groupId>
    <artifactId>kafka-serde-avro4s_2.11</artifactId>
    <version>0.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.azhur/kafka-serde-avro4s_2.11/
implementation 'io.github.azhur:kafka-serde-avro4s_2.11:0.4.0'
// https://jarcasting.com/artifacts/io.github.azhur/kafka-serde-avro4s_2.11/
implementation ("io.github.azhur:kafka-serde-avro4s_2.11:0.4.0")
'io.github.azhur:kafka-serde-avro4s_2.11:jar:0.4.0'
<dependency org="io.github.azhur" name="kafka-serde-avro4s_2.11" rev="0.4.0">
  <artifact name="kafka-serde-avro4s_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.azhur', module='kafka-serde-avro4s_2.11', version='0.4.0')
)
libraryDependencies += "io.github.azhur" % "kafka-serde-avro4s_2.11" % "0.4.0"
[io.github.azhur/kafka-serde-avro4s_2.11 "0.4.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
org.apache.kafka : kafka-clients jar 1.1.0
com.sksamuel.avro4s : avro4s-core_2.11 jar 1.9.0

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.11 jar 3.0.5

Project Modules

There are no modules declared in this project.

kafka-serde-scala

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

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

Add dependencies for the selected integration:

  • for avro4s:
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-avro4s" % "0.5.0",
)
  • for circe:
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-circe" % "0.5.0",
)
  • for jackson:
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-jackson" % "0.5.0",
)
  • for json4s:
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-json4s" % "0.5.0",
)
  • for jsoniter-scala:
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-jsoniter-scala" % "0.5.0",
  "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "0.29.2" % Provided // required only in compile-time
)
  • for play-json:
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-play-json" % "0.5.0"
)
  • for upickle:
libraryDependencies ++= List(
  "io.github.azhur" %% "kafka-serde-upickle" % "0.5.0"
)

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 avro4s: com.sksamuel.avro4s.SchemaFor[T], com.sksamuel.avro4s.ToRecord[T], com.sksamuel.avro4s.FromRecord[T]
  • for circe: io.circe.Encoder[T], io.circe.Decoder[T]
  • for jackson json: com.fasterxml.jackson.databind.ObjectMapper
  • for jackson binary: com.fasterxml.jackson.databind.ObjectMapper, org.codehaus.jackson.FormatSchema
  • for json4s: org.json4s.DefaultFormats, org.json4s.Serialization
  • for jsoniter-scala: com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec[T], (and optionally com.github.plokhotnyuk.jsoniter_scala.core.WriterConfig or/and com.github.plokhotnyuk.jsoniter_scala.core.ReaderConfig)
  • for play-json: play.api.libs.json.Reads, play.api.libs.json.Writes.
  • for upickle: upickle.default.Reader, upickle.default.Writer.

For more info, please, take a look at unit tests and at kafka-serde-scala-example which is a kafka-streams (2.0) 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.

Versions

Version
0.4.0
0.3.0