Skip to content

Instantly share code, notes, and snippets.

@rocketpages
Created August 22, 2015 02:46
Show Gist options
  • Save rocketpages/cbe9d12853b24fdb12e4 to your computer and use it in GitHub Desktop.
Save rocketpages/cbe9d12853b24fdb12e4 to your computer and use it in GitHub Desktop.
implicit val actorSystem = ActorSystem("ReactiveKafka")
implicit val materializer = ActorMaterializer()
val kafka = new ReactiveKafka(host = "localhost:9092", zooKeeperHost = "localhost:2181")
val publisher = kafka.consume("lowercaseStrings", "groupName", new StringDecoder())
val subscriber = kafka.publish("uppercaseStrings", "groupName", new StringEncoder())
// consume lowercase strings from kafka and publish them transformed to uppercase
Source(publisher).map(_.toUpperCase).to(Sink(subscriber)).run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment