Skip to content

Instantly share code, notes, and snippets.

{
"hostInfo":{
"host":"1.2.3.4",
"port":42
},
"stateStoreNames":[
"totalVisitCount",
"hourlyVisitCount",
"sessionVisitCount"
],
@ftrossbach
ftrossbach / Topology.java
Last active March 10, 2017 16:03
A simplified Kafka Streams topology
KStreamBuilder builder = new KStreamBuilder();
KStream<String, Long> visitsStream = builder.stream(Serdes.String(), Serdes.Long(), "visitsTopic");
KGroupedStream<String, Long> groupedStream = visitsStream.groupByKey();
KTable<String, Long> totalCount = groupedStream.count("totalVisitCount");
KTable<Windowed<String>, Long> windowedCount = groupedStream.count(TimeWindows.of(60 * 60 * 1000), "hourlyVisitCount");
groupedStream.count(SessionWindows.with(60 * 1000), "sessionVisitCount");
@ftrossbach
ftrossbach / SingleWebSocketRequest.scala
Created August 18, 2016 21:17
Meetup Druid example
package de.ftrossbach.meetup
import java.util.concurrent.TimeUnit
import akka.actor.ActorSystem
import akka.{Done, NotUsed}
import akka.http.scaladsl.Http
import akka.stream.ActorMaterializer
import akka.stream.scaladsl._
import akka.http.scaladsl.model._