Search in sources :

Example 6 with KeyValueBytesStoreSupplier

use of org.apache.kafka.streams.state.KeyValueBytesStoreSupplier in project kafkastreams-cep by fhussonnois.

the class QueryStoreBuilders method getAggregateStateStores.

/**
 * Build all {@link StoreBuilder} used to store aggregate states for stages.
 *
 * @return a new collection of {@link StoreBuilder}.
 */
public StoreBuilder<AggregatesStore<K>> getAggregateStateStores() {
    final String storeName = QueryStores.getQueryAggregateStatesStoreName(queryName);
    KeyValueBytesStoreSupplier storeSupplier = Stores.persistentKeyValueStore(storeName);
    return QueryStores.aggregatesStoreBuilder(storeSupplier);
}
Also used : KeyValueBytesStoreSupplier(org.apache.kafka.streams.state.KeyValueBytesStoreSupplier)

Example 7 with KeyValueBytesStoreSupplier

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

the class KeyValueStoreMaterializer method materialize.

/**
 * @return  StoreBuilder
 */
public StoreBuilder<KeyValueStore<K, V>> materialize() {
    KeyValueBytesStoreSupplier supplier = (KeyValueBytesStoreSupplier) materialized.storeSupplier();
    if (supplier == null) {
        final String name = materialized.storeName();
        supplier = Stores.persistentKeyValueStore(name);
    }
    final StoreBuilder<KeyValueStore<K, V>> builder = Stores.keyValueStoreBuilder(supplier, materialized.keySerde(), materialized.valueSerde());
    if (materialized.loggingEnabled()) {
        builder.withLoggingEnabled(materialized.logConfig());
    } else {
        builder.withLoggingDisabled();
    }
    if (materialized.cachingEnabled()) {
        builder.withCachingEnabled();
    }
    return builder;
}
Also used : KeyValueBytesStoreSupplier(org.apache.kafka.streams.state.KeyValueBytesStoreSupplier) KeyValueStore(org.apache.kafka.streams.state.KeyValueStore)

Aggregations

KeyValueBytesStoreSupplier (org.apache.kafka.streams.state.KeyValueBytesStoreSupplier)7 KeyValueStore (org.apache.kafka.streams.state.KeyValueStore)3 KafkaStreams (org.apache.kafka.streams.KafkaStreams)2 StreamsBuilder (org.apache.kafka.streams.StreamsBuilder)2 Test (org.junit.Test)2 Properties (java.util.Properties)1 Set (java.util.Set)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IntegerSerializer (org.apache.kafka.common.serialization.IntegerSerializer)1 Bytes (org.apache.kafka.common.utils.Bytes)1 Topology (org.apache.kafka.streams.Topology)1 ValueMapper (org.apache.kafka.streams.kstream.ValueMapper)1 KeyValueStoreMaterializer (org.apache.kafka.streams.kstream.internals.KeyValueStoreMaterializer)1 MaterializedInternal (org.apache.kafka.streams.kstream.internals.MaterializedInternal)1 Processor (org.apache.kafka.streams.processor.Processor)1 StateStore (org.apache.kafka.streams.processor.StateStore)1 ThreadMetadata (org.apache.kafka.streams.processor.ThreadMetadata)1 CachedStateStore (org.apache.kafka.streams.state.internals.CachedStateStore)1 InMemoryKeyValueStore (org.apache.kafka.streams.state.internals.InMemoryKeyValueStore)1