Skip to content

Latest commit

 

History

History
162 lines (130 loc) · 4.6 KB

kafka-streams-KTable.adoc

File metadata and controls

162 lines (130 loc) · 4.6 KB

KTable API — Changelog Stream

KTable is the abstraction of a changelog stream from a primary-keyed table. Each record in the changelog stream is an update on the primary-keyed table with the record key as the primary key.

KTable assumes that records from the source topic that have null keys are simply dropped.

KTable can be created directly from a Kafka topic (using StreamsBuilder.table operator), as a result of transformations on an existing KTable, or aggregations (aggregate, count, and reduce) of the following abstractions:

Tip
Use Scala API for Kafka Streams to make your Kafka Streams development more pleasant if Scala is your programming language.
Table 1. KTable API / Operators
Operator Description

filter

KTable<K, V> filter(
  Predicate<? super K, ? super V> predicate)
KTable<K, V> filter(
  Predicate<? super K, ? super V> predicate,
  Materialized<K, V, KeyValueStore<Bytes, byte[]>> materialized)

filterNot

KTable<K, V> filterNot(
  Predicate<? super K, ? super V> predicate)
KTable<K, V> filterNot(
  Predicate<? super K, ? super V> predicate,
  Materialized<K, V, KeyValueStore<Bytes, byte[]>> materialized)

groupBy

KGroupedTable<KR, VR> groupBy(
  KeyValueMapper<? super K, ? super V, KeyValue<KR, VR>> selector)
KGroupedTable<KR, VR> groupBy(
  KeyValueMapper<? super K, ? super V, KeyValue<KR, VR>> selector,
  Grouped<KR, VR> grouped)

join

KTable<K, VR> join(
  KTable<K, VO> other,
  ValueJoiner<? super V, ? super VO, ? extends VR> joiner)
KTable<K, VR> join(
  KTable<K, VO> other,
  ValueJoiner<? super V, ? super VO, ? extends VR> joiner,
  Materialized<K, VR, KeyValueStore<Bytes, byte[]>> materialized)

leftJoin

KTable<K, VR> leftJoin(
  KTable<K, VO> other,
  ValueJoiner<? super V, ? super VO, ? extends VR> joiner)
KTable<K, VR> leftJoin(
  KTable<K, VO> other,
  ValueJoiner<? super V, ? super VO, ? extends VR> joiner,
  Materialized<K, VR, KeyValueStore<Bytes, byte[]>> materialized)

mapValues

KTable<K, VR> mapValues(
  ValueMapper<? super V, ? extends VR> mapper)
KTable<K, VR> mapValues(
  ValueMapper<? super V, ? extends VR> mapper,
  Materialized<K, VR, KeyValueStore<Bytes, byte[]>> materialized)
KTable<K, VR> mapValues(
  ValueMapperWithKey<? super K, ? super V, ? extends VR> mapper)
KTable<K, VR> mapValues(
  ValueMapperWithKey<? super K, ? super V, ? extends VR> mapper,
  Materialized<K, VR, KeyValueStore<Bytes, byte[]>> materialized)

outerJoin

KTable<K, VR> outerJoin(
  KTable<K, VO> other,
  ValueJoiner<? super V, ? super VO, ? extends VR> joiner)
KTable<K, VR> outerJoin(
  KTable<K, VO> other,
  ValueJoiner<? super V, ? super VO, ? extends VR> joiner,
  Materialized<K, VR, KeyValueStore<Bytes, byte[]>> materialized)

queryableStoreName

String queryableStoreName()

suppress

KTable<K, V> suppress(
  Suppressed<? super K> suppressed)

toStream

KStream<K, V> toStream()
KStream<KR, V> toStream(
  KeyValueMapper<? super K, ? super V, ? extends KR> mapper)

transformValues

KTable<K, VR> transformValues(
  ValueTransformerWithKeySupplier<? super K, ? super V, ? extends VR> transformerSupplier,
  Materialized<K, VR, KeyValueStore<Bytes, byte[]>> materialized,
  String... stateStoreNames)
KTable<K, VR> transformValues(
  ValueTransformerWithKeySupplier<? super K, ? super V, ? extends VR> transformerSupplier,
  String... stateStoreNames)