Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: made the generic types match

...

Code Block
/**
* {@code CogroupedKStream} is an abstraction of multiple <i>grouped</i> record streams of {@link KeyValue} pairs.
* It is an intermediate representation of one or more {@link KStream}s in order to apply one or more aggregation
* operations on the original {@link KStream} records.
* <p>
* It is an intermediate representation after a grouping of {@link KStream}s, before the aggregations are applied to
* the new partitions resulting in a {@link KTable}.
* <p>
* A {@code CogroupedKStream} must be obtained from a {@link KGroupedStream} via 
* {@link KGroupedStream#cogroup(Initializer, Aggregator, org.apache.kafka.common.serialization.Serde, String) cogroup(...)}.
*
* @param <K> Type of keys
* @param <V> Type of aggregate values
*/
public interface CogroupedKStream<K, V>Vout> {
    <T><Vin> CogroupedKStream<K, V>Vout> cogroup(final KGroupedStream<K, T>Vin> groupedStream,
                                       final Aggregator<? super K, ? super TVin, V>Vout> aggregator);

    KTable<K, V>Vout> aggregate(final Initializer<V>Initializer<Vout> initializer,
                           final Materialized<K, VRVout, KeyValueStore<Bytes, byte[]>> materialized);
    
    KTable<K, V>Vout> aggregate(final Initializer<V>Initializer<Vout> initializer);

    <W extends Window> TimeWindowedKCogroupedStream<K, V>Vout> windowedBy(final Windows<W> windows);

    SessionWindowedKCogroupedStream<K, V>Vout> windowedBy(final SessionWindows sessionWindows);

}

...

Code Block
/**
 * {@code SessionWindowedCogroupKStream} is an abstraction of a <i>windowed</i> record stream of {@link org.apache.kafka.streams.KeyValue} pairs.
 * It is an intermediate representation of a {@link KGroupedStream} in order to apply a windowed aggregation operation on the original
 * {@link KGroupedStream} records.
 * <p>
 * It is an intermediate representation after a grouping, cogrouping and windowing of a {@link KStream} before an aggregation is applied to the
 * new (partitioned) windows resulting in a windowed {@link KTable}
 * (a <emph>windowed</emph> {@code KTable} is a {@link KTable} with key type {@link Windowed Windowed<K>}.
 * <p>
 * The specified {@code SessionWindows} define the gap between windows.
 * The result is written into a local windowed {@link org.apache.kafka.streams.state.KeyValueStore} (which is basically an ever-updating
 * materialized view) that can be queried using the name provided in the {@link Materialized} instance.
 *
 * New events are added to windows until their grace period ends (see {@link TimeWindows#grace(Duration)}).
 *
 * Furthermore, updates to the store are sent downstream into a windowed {@link KTable} changelog stream, where
 * "windowed" implies that the {@link KTable} key is a combined key of the original record key and a window ID.

 * A {@code WindowedKStream} must be obtained from a {@link KGroupedStream} via {@link KGroupedStream#windowedBy(Windows)} .
 *
 * @param <K> Type of keys
 * @param <T><V> Type of values
 * @see KStream
 * @see KGroupedStream
 * @see KCogroupedStream
 */
import org.apache.kafka.streams.state.SessionStore;

public interface SessionWindowedKCogroupedStream<K, V> {
    KTable<Windowed<K>, V>Vout> aggregate(final Initializer<V> initializer,
                                     final Merger<? super K, V> sessionMerger,
                                     final Materialized<K, V, SessionStore<Bytes, byte[]>> materialized);

    KTable<Windowed<K>, V> aggregate(final Initializer<V> initializer,
                                     final Merger<? super K, V> sessionMerger);

}

...