Skip to content

Instantly share code, notes, and snippets.

@songyunlu
Created March 12, 2017 03:00
Show Gist options
  • Save songyunlu/f13337d3303ed30b4898a947060d6f7c to your computer and use it in GitHub Desktop.
Save songyunlu/f13337d3303ed30b4898a947060d6f7c to your computer and use it in GitHub Desktop.
import org.apache.kafka.streams.kstream.KStreamBuilder;
import org.apache.kafka.streams.kstream.KStream;
import org.apache.kafka.streams.kstream.KTable;
KStreamBuilder builder = new KStreamBuilder();
// Create a stream of page view events from the PageViews topic, where the key of
// a record is assumed to be the user id (String) and the value an Avro GenericRecord
// that represents the full details of the page view event.
KStream<String, GenericRecord> pageViews = builder.stream("PageViews");
// Create a changelog stream for user profiles from the UserProfiles topic,
// where the key of a record is assumed to be the user id (String) and its value
// an Avro GenericRecord.
KTable<String, GenericRecord> userProfiles = builder.table("UserProfiles");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment