Skip to content

throuch/akka-kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

akka stream - kafka

Code sample for Scala developpers

sbt dependencies:

libraryDependencies ++= Seq(
    "com.typesafe.akka" %% "akka-stream-kafka" % "1.0.5"
    "com.typesafe" %% "config" % "1.3.1",
     "org.json4s" %% "json4s-jackson" % "3.1.0"
  )

Helper trait to be able to publish any object as a JSON message to a Kafka broker as simply as possible

 .... with ThornKafkaProducer ... {
 ...
 implicit override val formats = MyJsonConverter.formats // NOT REQUIRED if object to serialize uses only basic types (see json4s for details)
 implicit val  m: ActorMaterializer = ActorMaterializer()
 ...
 pushMessageToKafka(event, TOPIC_NAME)
 ...
 kafkaProducer.close()
}

About

Code sample for Scala developpers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages