@Override public void init(final ProcessorContext context, final StateStore root) { initInternal(context); underlying.init(context, root); // save the stream thread as we only ever want to trigger a flush // when the stream thread is the current thread. streamThread = Thread.currentThread(); }
public void init(final ProcessorContext context, final StateStore root) { final String storeName = bytesStore.name(); topic = ProcessorStateManager.storeChangelogTopic(context.applicationId(), storeName); bytesStore.init(context, root); serdes = new StateSerdes<>(topic, new AggregateKeySerde<>(), new KryoSerDe<>()); }
@Override @SuppressWarnings("unchecked") public void init(final ProcessorContext context, final StateStore root) { final String storeName = bytesStore.name(); topic = ProcessorStateManager.storeChangelogTopic(context.applicationId(), storeName); final Serde<MatchedEvent<K, V>> valueSerDes = new MatchedEventSerde<>( keySerde == null ? (Serde<K>) context.keySerde() : keySerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde); this.serdes = new StateSerdes<>(topic, new KryoSerDe<Matched>(), valueSerDes); bytesStore.init(context, root); }
public void init(final ProcessorContext context, final StateStore root) { final String storeName = bytesStore.name(); topic = ProcessorStateManager.storeChangelogTopic(context.applicationId(), storeName); bytesStore.init(context, root); Serde<K> kSerde = keySerde == null ? (Serde<K>) context.keySerde() : keySerde; Serde<NFAStates<K, V>> serdes = new NFAStateValueSerde<>( new ComputationStageSerde<>(stages, kSerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde)); this.serdes = new StateSerdes<>(topic, new RunnedKeySerde<>(kSerde), serdes); }
@Override public void init(final ProcessorContext context, final StateStore root) { inner.init(context, root); final String topic = ProcessorStateManager.storeChangelogTopic(context.applicationId(), inner.name()); this.changeLogger = new StoreChangeLogger<>(inner.name(), context, new StateSerdes<>(topic, Serdes.Bytes(), Serdes.ByteArray())); // if the inner store is an LRU cache, add the eviction listener to log removed record if (inner instanceof MemoryLRUCache) { ((MemoryLRUCache<Bytes, byte[]>) inner).whenEldestRemoved(new MemoryLRUCache.EldestEntryRemovalListener<Bytes, byte[]>() { @Override public void apply(final Bytes key, final byte[] value) { // pass null to indicate removal changeLogger.logChange(key, null); } }); } }
@Override @SuppressWarnings("unchecked") public void init(final ProcessorContext context, final StateStore root) { inner.init(context, root); // construct the serde final StateSerdes<K, V> serdes = new StateSerdes<>( ProcessorStateManager.storeChangelogTopic(context.applicationId(), inner.name()), keySerde == null ? (Serde<K>) context.keySerde() : keySerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde); this.changeLogger = new StoreChangeLogger<>(inner.name(), context, serdes); // if the inner store is an LRU cache, add the eviction listener to log removed record if (inner instanceof MemoryLRUCache) { ((MemoryLRUCache<K, V>) inner).whenEldestRemoved(new MemoryNavigableLRUCache.EldestEntryRemovalListener<K, V>() { @Override public void apply(final K key, final V value) { removed(key); } }); } }
@Override @SuppressWarnings("unchecked") public void init(ProcessorContext context, StateStore root) { inner.init(context, root); // construct the serde StateSerdes<K, V> serdes = new StateSerdes<>( ProcessorStateManager.storeChangelogTopic(context.applicationId(), inner.name()), keySerde == null ? (Serde<K>) context.keySerde() : keySerde, valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde); // Twitter Changed //this.changeLogger = new StoreChangeLogger<>(inner.name(), context, serdes); this.changeLogger = new StoreChangeFlushingLogger<>(inner.name(), context, serdes); // if the inner store is an LRU cache, add the eviction listener to log removed record if (inner instanceof MemoryLRUCache) { ((MemoryLRUCache<K, V>) inner).whenEldestRemoved(new MemoryNavigableLRUCache.EldestEntryRemovalListener<K, V>() { @Override public void apply(K key, V value) { removed(key); } }); } }