zalando-nakadi / nakadi-klients-play-json Edit

Provides play-json support for the various nakadi-klients models.

Version Matrix

Nakadi Klients Play Json Support

Provides play-json support for the various nakadi-klients models.


sbt compile


Add the following to your build.sbt when using SBT.

libraryDependencies += "org.zalando.nakadi.client" %% "nakadi-klients-play-json" % "0.1.0"


Implicit play-json formats are can be imported by doing

import org.zalando.nakadi.client.scala.PlayJsonImplicits._

Note that the play-json formats are recursive, so you also need to provide a Format/Read/Writes for the base Event type you are dealing with.

This library also provides a generic serialization method which can be passed as a parameter to the nakadi client.publishEvents(..) call, i.e.

import org.zalando.nakadi.client.scala.model._
import org.zalando.nakadi.client.scala.{Client, ClientError}
import org.zalando.nakadi.client.utils.ClientBuilder
import org.zalando.nakadi.client.scala.NakadiSerializer

case class MyEvent(message: String)

val events = Seq(MyEvent("Dino was born, he says rawr"))

val dataChangeEvents = { event =>
  DataChangeEvent(event, "my_model", DataOperation.CREATE, None)

val client: Client = ClientBuilder()
  .withTokenProvider(Option(() => "some_token"))


Note that in this example, you have to provide an implicit Writes for MyEvent

Please make sure that you format the code using scalafmt. You can do this by running scalafmt in sbt before committing. See scalafmt for more info.


Copyright © 2016 Zalando SE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.