示例#1
0
        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);
                    //}
                }
            }
        }