protected virtual StreamPipeline ComposeOffPipeline(string id, DataExchange exchange)
        {
            var offlinePipeline = new StreamPipeline();

            Dictionary<string, int> time = new Dictionary<string, int>();

            var trainUntil = testStartDateProvider.GetTimestampOfTestStart(id);

            offlinePipeline.Register(new offPredictionFittingFilter(parameters, trainUntil, time, exchange));

            return offlinePipeline;
        }
        public void Start(string id, IMessageQueue queue)
        {
            var suffix = Guid.NewGuid().ToString();

            var pipeline = new StreamPipeline();

            pipeline.Register(new MeanPredictionFilter());
            pipeline.Register(new ResultOutputFilter(repository) { MeasurementId = id, ForecastModelId = name });

            var task1 = Task.Factory.StartNew(() => { RegisterStream(queue, pipeline, id + "-online-" + suffix, id); });

            Task.WaitAll(task1);
        }
        protected virtual StreamPipeline ComposeOnPipeline(string id, DataExchange exchange, string name)
        {
            var onlinePipeline = new StreamPipeline();

            parameters = new FilterParameters();

            var trainUntil = testStartDateProvider.GetTimestampOfTestStart(id);

            onlinePipeline.Register(new onNeuralPredictionFilter(parameters, trainUntil, exchange));
            onlinePipeline.Register(new onErrorCalculationFilter(parameters));

            onlinePipeline.Register(new ResultOutputFilter(repository) { MeasurementId = id, ForecastModelId = name});

            return onlinePipeline;
        }
 private void RegisterStream(IMessageQueue messageQueue, StreamPipeline pipeline, string pipelineName, string id)
 {
     while (true)
     {
         try
         {
             var units = messageQueue.Dequeue(id, pipelineName);
             pipeline.Execute(units);
         }
         catch (EndOfStreamException)
         {
             Console.WriteLine("End of stream");
             break;
         }
         catch (Exception ex)
         {
             Logging.Debug(ex.ToString());
             throw;
         }
     }
 }
 public StreamPipeline UpdatePipeline(StreamPipeline sourcePipeline, Command command)
 {
     return sourcePipeline;
 }