internal IKTable <K, V> Table <K, V>(string topic, ConsumedInternal <K, V> consumed, Materialized <K, V, IKeyValueStore <Bytes, byte[]> > materialized) { var sourceName = new Named(consumed.Named).SuffixWithOrElseGet(TABLE_SOURCE_SUFFIX, this, KStream.SOURCE_NAME); var tableSourceName = new Named(consumed.Named).OrElseGenerateWithPrefix(this, KTable.SOURCE_NAME); KTableSource <K, V> tableSource = new KTableSource <K, V>(materialized.StoreName, materialized.QueryableStoreName); ProcessorParameters <K, V> processorParameters = new ProcessorParameters <K, V>(tableSource, tableSourceName); var tableSourceNode = new TableSourceNode <K, V, IKeyValueStore <Bytes, byte[]> >( topic, tableSourceName, sourceName, consumed, materialized, processorParameters, false); this.AddGraphNode(root, tableSourceNode); return(new KTable <K, V, V>(tableSourceName, consumed.KeySerdes, consumed.ValueSerdes, new List <string> { sourceName }, materialized.QueryableStoreName, tableSource, tableSourceNode, this)); }
public override void WriteToTopology(InternalTopologyBuilder builder) { // TODO: we assume source KTables can only be timestamped-key-value stores for now. // should be expanded for other types of stores as well. StoreBuilder <State.TimestampedKeyValueStore <K, V> > storeBuilder = new TimestampedKeyValueStoreMaterializer <K, V>(materialized as Materialized <K, V, IKeyValueStore <Bytes, byte[]> >).Materialize(); if (isGlobalKTable) { builder.AddGlobalStore(topicName, storeBuilder, sourceName, consumed, processorParameters); } else { builder.AddSourceOperator(this.topicName, sourceName, consumed); builder.AddProcessor(processorParameters.ProcessorName, processorParameters.Processor, sourceName); //// only add state store if the source KTable should be materialized KTableSource <K, V> ktableSource = (KTableSource <K, V>)processorParameters.Processor; if (ktableSource.QueryableName != null) { builder.AddStateStore(storeBuilder, this.streamGraphNode); // TODO : //if (shouldReuseSourceTopicForChangelog) //{ // storeBuilder.withLoggingDisabled(); // topologyBuilder.connectSourceStoreAndTopic(storeBuilder.name(), topicName); //} } } }
internal IGlobalKTable <K, V> GlobalTable <K, V>(string topic, ConsumedInternal <K, V> consumed, Materialized <K, V, IKeyValueStore <Bytes, byte[]> > materialized) { if (string.IsNullOrEmpty(topic)) { throw new ArgumentException("topic can't be null or empty", nameof(topic)); } // explicitly disable logging for global stores materialized.WithLoggingDisabled(); string sourceName = new Named(consumed.Named).SuffixWithOrElseGet(TABLE_SOURCE_SUFFIX, this, KStream.SOURCE_NAME); string tableSourceName = new Named(consumed.Named).OrElseGenerateWithPrefix(this, KTable.SOURCE_NAME); string storeName = materialized.StoreName; // enforce store name as queryable name to always materialize global table stores var tableSource = new KTableSource <K, V>(storeName, storeName); var processorParameters = new ProcessorParameters <K, V>(tableSource, tableSourceName); var tableSourceNode = new TableSourceNode <K, V, IKeyValueStore <Bytes, byte[]> >( topic, tableSourceName, sourceName, consumed, materialized, processorParameters, true); this.AddGraphNode(root, tableSourceNode); return(new GlobalKTable <K, V>(new KTableSourceValueGetterSupplier <K, V>(storeName), materialized.QueryableStoreName)); }
public void EnableSendingOldValues() { if (!SendOldValues) { if (processorSupplier != null && processorSupplier is KTableSource <K, V> ) { KTableSource <K, V> source = (KTableSource <K, V>)processorSupplier; source.EnableSendingOldValues(); } // TODO : //} else if (processorSupplier instanceof KStreamAggProcessorSupplier) { // ((KStreamAggProcessorSupplier <?, K, S, V >) processorSupplier).enableSendingOldValues(); //} else else if (tableProcessorSupplier != null && tableProcessorSupplier is IKTableProcessorSupplier) { (tableProcessorSupplier as IKTableProcessorSupplier).EnableSendingOldValues(); } SendOldValues = true; } }