public SinkNodeFactory(string name, string[] previous, ITopicNameExtractor <K, V> topicExtractor, ISerDes <K> keySerdes, ISerDes <V> valueSerdes)
     : base(name, previous)
 {
     Extractor   = topicExtractor;
     KeySerdes   = keySerdes;
     ValueSerdes = valueSerdes;
 }
        private void DoTo(ITopicNameExtractor <K, V> topicExtractor, Produced <K, V> produced)
        {
            string name = new Named(produced.Named).OrElseGenerateWithPrefix(this.builder, SINK_NAME);

            StreamSinkNode <K, V> sinkNode = new StreamSinkNode <K, V>(topicExtractor, name, produced);

            this.builder.AddGraphNode(node, sinkNode);
        }
Beispiel #3
0
 public SinkNodeFactory(string name, string[] previous, ITopicNameExtractor <K, V> topicExtractor,
                        ISerDes <K> keySerdes, ISerDes <V> valueSerdes, Func <string, K, V, int> producedPartitioner)
     : base(name, previous)
 {
     Extractor           = topicExtractor;
     KeySerdes           = keySerdes;
     ValueSerdes         = valueSerdes;
     ProducedPartitioner = producedPartitioner;
 }
        internal void AddSinkOperator<K, V>(ITopicNameExtractor<K, V> topicNameExtractor, string nameNode, Produced<K, V> produced, params string[] previousProcessorNames)
        {
            if (nodeFactories.ContainsKey(nameNode))
                throw new TopologyException($"Sink processor {nameNode} is already added.");

            nodeFactories.Add(nameNode,
                new SinkNodeFactory<K, V>(nameNode, previousProcessorNames, topicNameExtractor, produced.KeySerdes, produced.ValueSerdes));
            nodeGrouper.Add(nameNode);
            nodeGrouper.Unite(nameNode, previousProcessorNames);
            nodeGroups = null;
        }
Beispiel #5
0
 internal void AddSinkOperator <K, V>(ITopicNameExtractor <K, V> topicNameExtractor, string nameNode, Produced <K, V> produced)
 {
     if (!sinkOperators.ContainsKey(nameNode))
     {
         SinkProcessor <K, V> sink = new SinkProcessor <K, V>(nameNode, null, topicNameExtractor, produced.KeySerdes, produced.ValueSerdes);
         sinkOperators.Add(nameNode, sink);
     }
     else
     {
         throw new Exception("Sink operator already exist !");
     }
 }
 internal SinkProcessor(string name, ITopicNameExtractor <K, V> topicNameExtractor, ISerDes <K> keySerdes, ISerDes <V> valueSerdes)
     : base(name, keySerdes, valueSerdes)
 {
     this.topicNameExtractor = topicNameExtractor;
 }
Beispiel #7
0
 public void UseRepartitionTopic(string repartitionTopic)
 => topicNameExtractor = new StaticTopicNameExtractor <K, V>(repartitionTopic);
Beispiel #8
0
 internal SinkProcessor(string name, ITopicNameExtractor <K, V> topicNameExtractor, ISerDes <K> keySerdes, ISerDes <V> valueSerdes, Func <string, K, V, int> partitioner = null)
     : base(name, keySerdes, valueSerdes)
 {
     this.topicNameExtractor = topicNameExtractor;
     this.partitioner        = partitioner;
 }
 public void To <KS, VS>(ITopicNameExtractor <K, V> topicExtractor, string named = null)
     where KS : ISerDes <K>, new()
     where VS : ISerDes <V>, new()
 => DoTo(topicExtractor, Produced <K, V> .Create <KS, VS>().WithName(named));
 public void To(ITopicNameExtractor <K, V> topicExtractor, string named = null) => DoTo(topicExtractor, Produced <K, V> .Create(keySerdes, valueSerdes).WithName(named));