Alpakka sample

Read from a Kafka topic and publish to Elasticsearch

This example uses Alpakka Kafka to subscribe to a Kafka topic, parses JSON into a data class and stores the object in Elasticsearch. After storing the Kafka offset is committed back to Kafka. This gives at-least-once semantics.

Browse the sources at Github.

To try out this project clone the Alpakka Samples repository and find it in the alpakka-sample-kafka-to-elasticsearch directory.

Dependencies

Dependencies (sbt notation)
val AkkaVersion = "2.6.9"
val AlpakkaVersion = "2.0.1"
val AlpakkaKafkaVersion = "2.0.5"

  "com.lightbend.akka" %% "akka-stream-alpakka-elasticsearch" % AlpakkaVersion,
  "com.typesafe.akka" %% "akka-stream-kafka" % AlpakkaKafkaVersion,
  "com.typesafe.akka" %% "akka-stream" % AkkaVersion,
  "com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion,
  "com.typesafe.akka" %% "akka-actor" % AkkaVersion,
  // for JSON in Scala
  "io.spray" %% "spray-json" % "1.3.5",
  // for JSON in Java
  "com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % "2.10.5",
  "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.10.5",
  // Logging
  "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion,
  "ch.qos.logback" % "logback-classic" % "1.2.3",

All Alpakka samples

Show Alpakka samples listing.

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.