Search in sources :

Example 1 with QueriedInternal

use of com.github.fhuss.kafka.streams.cep.state.internal.QueriedInternal in project kafkastreams-cep by fhussonnois.

the class QueryStoreBuilders method getAggregateStateStore.

/**
 * Build all {@link StoreBuilder} used to store aggregate states for stages.
 *
 * @return a new collection of {@link StoreBuilder}.
 */
public StoreBuilder<AggregatesStateStore<K>> getAggregateStateStore(final Queried<K, V> queried) {
    final String storeName = QueryStores.getQueryAggregateStatesStoreName(queryName);
    final QueriedInternal<K, V> internal = new QueriedInternal<>(queried);
    KeyValueBytesStoreSupplier supplier = (KeyValueBytesStoreSupplier) internal.storeSupplier();
    if (supplier == null) {
        supplier = Stores.persistentKeyValueStore(storeName);
    }
    final StoreBuilder<AggregatesStateStore<K>> builder = QueryStores.aggregatesStoreBuilder(supplier);
    return mayEnableCaching(internal, mayEnableLogging(internal, builder));
}
Also used : KeyValueBytesStoreSupplier(org.apache.kafka.streams.state.KeyValueBytesStoreSupplier) QueriedInternal(com.github.fhuss.kafka.streams.cep.state.internal.QueriedInternal)

Example 2 with QueriedInternal

use of com.github.fhuss.kafka.streams.cep.state.internal.QueriedInternal in project kafkastreams-cep by fhussonnois.

the class QueryStoreBuilders method getEventBufferStore.

/**
 * Build a new {@link StoreBuilder} used to store match sequences.
 *
 * @param queried the {@link Queried} instance.
 *
 * @return a new {@link StoreBuilder} instance.
 */
public StoreBuilder<SharedVersionedBufferStateStore<K, V>> getEventBufferStore(final Queried<K, V> queried) {
    final String storeName = QueryStores.getQueryEventBufferStoreName(queryName);
    final QueriedInternal<K, V> internal = new QueriedInternal<>(queried);
    KeyValueBytesStoreSupplier supplier = (KeyValueBytesStoreSupplier) internal.storeSupplier();
    if (supplier == null) {
        supplier = Stores.persistentKeyValueStore(storeName);
    }
    StoreBuilder<SharedVersionedBufferStateStore<K, V>> builder = QueryStores.bufferStoreBuilder(supplier, internal.keySerde(), internal.valueSerde());
    return mayEnableCaching(internal, mayEnableLogging(internal, builder));
}
Also used : KeyValueBytesStoreSupplier(org.apache.kafka.streams.state.KeyValueBytesStoreSupplier) QueriedInternal(com.github.fhuss.kafka.streams.cep.state.internal.QueriedInternal)

Example 3 with QueriedInternal

use of com.github.fhuss.kafka.streams.cep.state.internal.QueriedInternal in project kafkastreams-cep by fhussonnois.

the class QueryStoreBuilders method getNFAStateStore.

/**
 * Build a persistent {@link StoreBuilder}.
 *
 * @param queried the {@link Queried} instance.
 *
 * @return a new {@link StoreBuilder} instance.
 */
public StoreBuilder<NFAStateStore<K, V>> getNFAStateStore(final Queried<K, V> queried) {
    final String storeName = QueryStores.getQueryNFAStoreName(queryName);
    final QueriedInternal<K, V> internal = new QueriedInternal<>(queried);
    KeyValueBytesStoreSupplier supplier = (KeyValueBytesStoreSupplier) internal.storeSupplier();
    if (supplier == null) {
        supplier = Stores.persistentKeyValueStore(storeName);
    }
    final NFAStoreBuilder<K, V> builder = QueryStores.nfaStoreBuilder(supplier, stages.getAllStages(), internal.keySerde(), internal.valueSerde());
    return mayEnableCaching(internal, mayEnableLogging(internal, builder));
}
Also used : KeyValueBytesStoreSupplier(org.apache.kafka.streams.state.KeyValueBytesStoreSupplier) QueriedInternal(com.github.fhuss.kafka.streams.cep.state.internal.QueriedInternal)

Aggregations

QueriedInternal (com.github.fhuss.kafka.streams.cep.state.internal.QueriedInternal)3 KeyValueBytesStoreSupplier (org.apache.kafka.streams.state.KeyValueBytesStoreSupplier)3