2.11.4. Kafka KStream Interface

public interface KStream <K,V> {

    // Filter stream by predicate.
    KStream <K,V> filter (Predicate <? super K, ? super V> predicate);
    KStream <K,V> filterNot (Predicate <? super K, ? super V> predicate);

    // Replace key with new key.
    <KR> KStream <KR,V> selectKey (KeyValueMapper <? super K, ? super V, ? extends KR> mapper);

    // Map entry to new entry.
    <KR,VR> KStream <KR,VR> map (KeyValueMapper <
        ? super K, ? super V,
        ? extends KeyValue <? extends KR, ? extends VR>> mapper);

    // Map value to new value.
    <VR> KStream <K,VR> mapValues (ValueMapper <? super V, ? extends VR> mapper);

    // Map entry to multiple new entries.
    <KR,VR> KStream <KR,VR> flatMap (KeyValueMapper <
        ? super K, ? super V,
        ? extends Iterable <? extends KeyValue <? extends KR, ? extends VR>> mapper);

    // Map value to multiple new values.
    <VR> KStream <K,VR> flatMapValues (ValueMapper <? super V, ? extends Iterable <? extends VR>> mapper);

    // Print entries.
    void print (Printed <K, V> printed);

    // Consume or peek at entries with action.
    void foreach (ForeachAction <? super K, ? super V> action);
    KStream <K,V> peek (ForeachAction <? super K, ? super V> action);

    // Split by predicate or merge a stream.
    KStream <K,V> [] branch (Predicate <? super K, ? super V> ... predicates);
    KStream <K,V> merge (KStream <K,V> stream);

    // Materialize a stream into a topic.
    KStream <K,V> through (String topic);
    void to (String topic);

    // Process a stream using a stateful processor.
    <KO,VO> KStream <KO,VO> process (
        ProcessorSupplier <? super K, ? super V, KO, VO> processorSupplier,
        String... stateStoreNames);
    <VO> KStream <K,VO> processValues (
        FixedKeyProcessorSupplier <? super K, ? super V, VO> processorSupplier,
        String... stateStoreNames);

    // Group entries in a stream.
    KGroupedStream <K,V> groupByKey ();
    <KR> KGroupedStream <KR,V> groupBy (KeyValueMapper <? super K, ? super V, KR> selector);

    // Join stream with another stream or table on key.
    // Operation on streams limited by join window.
    <VO,VR> KStream <K,VR> join (
        KStream <K, VO> otherStream,
        ValueJoiner <? super V, ? super VO, ? extends VR> joiner,
        JoinWindows windows);
    <VO,VR> KStream <K,VR> leftJoin (
        KStream <K, VO> otherStream,
        ValueJoiner <? super V, ? super VO, ? extends VR> joiner,
        JoinWindows windows);
    <VO,VR> KStream <K,VR> outerJoin (
        KStream <K,VO> otherStream,
        ValueJoiner <? super V, ? super VO, ? extends VR> joiner,
        JoinWindows windows);
    <VT,VR> KStream <K,VR> join (
        KTable <K,VT> table,
        ValueJoiner <? super V, ? super VT, ? extends VR> joiner,
        Joined <K, V, VT> joined);
    <VT,VR> KStream <K,VR> leftJoin (
        KTable <K,VT> table,
        ValueJoiner <? super V, ? super VT, ? extends VR> joiner);

    ...
}