private void PipeInput(TestRecord <K, V> record)
        {
            DateTime ts    = record.Timestamp.HasValue ? record.Timestamp.Value : DateTime.Now;
            var      tuple = GetBytes(record.Key, record.Value);

            pipe.Pipe(tuple.Item1, tuple.Item2, ts);
            pipe.Flush();
        }
Пример #2
0
 private void PipeInput(string topic, TestRecord <K, V> record)
 {
     if (pipes.ContainsKey(topic))
     {
         DateTime ts    = record.Timestamp.HasValue ? record.Timestamp.Value : LastDate;
         var      tuple = GetBytes(topic, record.Key, record.Value);
         pipes[topic].Pipe(tuple.Item1, tuple.Item2, ts);
     }
     else
     {
         throw new ArgumentException($"{topic} doesn't found in this MultiInputTopic !");
     }
 }
        /// <summary>
        /// Send input records with the given record list on the topic,  then commit each record individually.
        /// </summary>
        /// <param name="inputs">List of keyvalues</param>
        /// <param name="timestamp">Date of the first record</param>
        /// <param name="advance">Timespan added at the previous record to get the current timestamp</param>
        public void PipeInputs(IEnumerable <KeyValuePair <K, V> > inputs, DateTime timestamp, TimeSpan advance)
        {
            DateTime ts      = timestamp;
            var      records = new List <TestRecord <K, V> >();

            foreach (var i in inputs)
            {
                var r = new TestRecord <K, V>
                {
                    Key       = i.Key,
                    Value     = i.Value,
                    Timestamp = ts
                };
                records.Add(r);
                ts += advance;
            }

            this.PipeInputs(records);
        }