/// <summary> /// Create a <see cref="IKTable{K, V}"/> for the specified topic. /// The default "auto.offset.reset" strategy, <see cref="ITimestampExtractor"/> as specified in the <see cref="IStreamConfig"/> are used. /// Input keyvalue records with null key will be dropped. /// /// Note that the specified input topic must be partitioned by key. /// If this is not the case the returned <see cref="IKTable{K, V}"/> will be corrupted. /// /// The resulting <see cref="IKTable{K, V}"/> will be materialized in a local <see cref="IKeyValueStore{K, V}"/> using the given /// <see cref="Materialized{K, V, S}"/> instance. /// </summary> /// <typeparam name="K">Key type of record</typeparam> /// <typeparam name="V">Value type of record</typeparam> /// <param name="topic">the topic name, can't be null</param> /// <param name="keySerdes">Key deserializer</param> /// <param name="valueSerdes">Value deserializer</param> /// <param name="materialized">the instance of <see cref="Materialized{K, V, S}"/> used to materialize a state store.</param> /// <param name="named">Processor name</param> /// <param name="extractor">the timestamp extractor to used. If null the default timestamp extractor from config will be used</param> /// <returns>a <see cref="IKTable{K, V}"/> for the specified topic</returns> public IKTable <K, V> Table <K, V>(string topic, ISerDes <K> keySerdes, ISerDes <V> valueSerdes, Materialized <K, V, IKeyValueStore <Bytes, byte[]> > materialized, string named, ITimestampExtractor extractor) { materialized = materialized ?? Materialized <K, V, IKeyValueStore <Bytes, byte[]> > .Create(); var consumedInternal = new ConsumedInternal <K, V>(named, keySerdes, valueSerdes, extractor); materialized.UseProvider(internalStreamBuilder, $"{topic}-")?.InitConsumed(consumedInternal); return(internalStreamBuilder.Table(topic, consumedInternal, materialized)); }
/// <summary> /// Create a <see cref="IKTable{K, V}"/> for the specified topic. /// Input keyvalue records with null key will be dropped. /// /// Note that the specified input topic must be partitioned by key. /// If this is not the case the returned <see cref="IKTable{K, V}"/> will be corrupted. /// /// The resulting <see cref="IKTable{K, V}"/> will be materialized in a local <see cref="IKeyValueStore{K, V}"/> using the given /// <see cref="Materialized{K, V, S}"/> instance. /// </summary> /// <typeparam name="K">Key type of record</typeparam> /// <typeparam name="V">Value type of record</typeparam> /// <param name="topic">the topic name, can't be null</param> /// <param name="keySerdes">Key deserializer</param> /// <param name="valueSerdes">Value deserializer</param> /// <param name="materialized">the instance of <see cref="Materialized{K, V, S}"/> used to materialize a state store.</param> /// <param name="named">Processor name</param> /// <param name="extractor">the timestamp extractor to be used. If null the default timestamp extractor from config will be used</param> /// <returns>a <see cref="IKTable{K, V}"/> for the specified topic</returns> /// <exception cref="ArgumentException">Throw <see cref="ArgumentException"/> if topic is null or empty</exception> public IKTable <K, V> Table <K, V>(string topic, ISerDes <K> keySerdes, ISerDes <V> valueSerdes, Materialized <K, V, IKeyValueStore <Bytes, byte[]> > materialized, string named, ITimestampExtractor extractor) { if (string.IsNullOrEmpty(topic)) { throw new ArgumentException("Topic of KTable must not be null or empty"); } materialized = materialized ?? Materialized <K, V, IKeyValueStore <Bytes, byte[]> > .Create(); var consumedInternal = new ConsumedInternal <K, V>(named, keySerdes, valueSerdes, extractor); materialized.UseProvider(internalStreamBuilder, $"{topic}-").InitConsumed(consumedInternal); return(internalStreamBuilder.Table(topic, consumedInternal, materialized)); }