Alpakka sample
Read from an MQTT topic, group messages and publish to Kafka
Subscribe to an MQTT topic with Alpakka MQTT, group a few values and publish the aggregate to a Kafka topic with Alpakka Kafka.
Browse the sources at Github.
To try out this project clone the Alpakka Samples repository and find it in the alpakka-sample-mqtt-to-kafka
directory.
Dependencies
- Dependencies (sbt notation)
-
source
val AkkaVersion = "2.9.0" val AlpakkaVersion = "7.0.2" val AlpakkaKafkaVersion = "5.0.0" val JacksonDatabindVersion = "2.15.2" "com.lightbend.akka" %% "akka-stream-alpakka-mqtt" % 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, "org.scala-lang.modules" %% "scala-collection-compat" % "2.1.4", // JSON "com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % JacksonDatabindVersion, "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % JacksonDatabindVersion, "com.fasterxml.jackson.module" %% "jackson-module-scala" % JacksonDatabindVersion, // Logging "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion, "ch.qos.logback" % "logback-classic" % "1.2.3",
All Alpakka samples
Show Alpakka samples listing.