Search in sources :

Example 6 with WindowStore

use of org.apache.kafka.streams.state.WindowStore in project apache-kafka-on-k8s by banzaicloud.

the class TimeWindowedKStreamImpl method materialize.

private <VR> StoreBuilder<WindowStore<K, VR>> materialize(final MaterializedInternal<K, VR, WindowStore<Bytes, byte[]>> materialized) {
    WindowBytesStoreSupplier supplier = (WindowBytesStoreSupplier) materialized.storeSupplier();
    if (supplier == null) {
        supplier = Stores.persistentWindowStore(materialized.storeName(), windows.maintainMs(), windows.segments, windows.size(), false);
    }
    final StoreBuilder<WindowStore<K, VR>> builder = Stores.windowStoreBuilder(supplier, materialized.keySerde(), materialized.valueSerde());
    if (materialized.loggingEnabled()) {
        builder.withLoggingEnabled(materialized.logConfig());
    } else {
        builder.withLoggingDisabled();
    }
    if (materialized.cachingEnabled()) {
        builder.withCachingEnabled();
    }
    return builder;
}
Also used : WindowStore(org.apache.kafka.streams.state.WindowStore) WindowBytesStoreSupplier(org.apache.kafka.streams.state.WindowBytesStoreSupplier)

Aggregations

WindowStore (org.apache.kafka.streams.state.WindowStore)6 GenericRow (io.confluent.ksql.GenericRow)3 KGroupedStream (org.apache.kafka.streams.kstream.KGroupedStream)3 Test (org.junit.Test)3 UdafAggregator (io.confluent.ksql.function.UdafAggregator)2 Arrays (java.util.Arrays)2 Properties (java.util.Properties)2 Serdes (org.apache.kafka.common.serialization.Serdes)2 KafkaStreams (org.apache.kafka.streams.KafkaStreams)2 StreamsBuilder (org.apache.kafka.streams.StreamsBuilder)2 StreamsConfig (org.apache.kafka.streams.StreamsConfig)2 Initializer (org.apache.kafka.streams.kstream.Initializer)2 KStream (org.apache.kafka.streams.kstream.KStream)2 TimeWindowedKStream (org.apache.kafka.streams.kstream.TimeWindowedKStream)2 EmbeddedSingleNodeKafkaCluster (io.confluent.examples.streams.kafka.EmbeddedSingleNodeKafkaCluster)1 KsqlWindowExpression (io.confluent.ksql.parser.tree.KsqlWindowExpression)1 File (java.io.File)1 Files (java.nio.file.Files)1 List (java.util.List)1 UUID (java.util.UUID)1