Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        internal KStream <K, V> Stream <K, V>(string topic, ConsumedInternal <K, V> consumed)
        {
            var name = new Named(consumed.Named).OrElseGenerateWithPrefix(this, KStream.SOURCE_NAME);
            var node = new StreamSourceNode <K, V>(topic, name, consumed);

            this.AddGraphNode(root, node);
            KStream <K, V> stream = new KStream <K, V>(name, consumed.KeySerdes, consumed.ValueSerdes, new List <string> {
                name
            }, node, this);

            return(stream);
        }