Ejemplo n.º 1
0
        private static void Save(ArticleTrendingsDal dal, int[] shortTrendArticleIds, int[] longTrendArticleIds)
        {
            var dto = new TrendingsDto {
                ShortTrendingArticleIds = shortTrendArticleIds, LongTrendingArticleIds = longTrendArticleIds
            };

            dal.SaveAll(dto);
            Console.WriteLine("Trendings updated.");
        }
Ejemplo n.º 2
0
        private static void Main()
        {
            Console.WriteLine($"Scheduled job: Trending Query Service ETL - REPORTER - (c) Gustin AG 2020 {Environment.NewLine}");

            var sourceDal      = new ArticleTrendingEventsDal(new LocalDockerMongoConfig(), TrendingDatabase.Reporting);
            var destinationDal = new ArticleTrendingsDal();

            var now = DateTime.UtcNow;
            var shortTrendStartTime = now.AddHours(-ShortTrendHours);
            var longTrendStartTime  = now.AddHours(-LongTrendHours);

            var extractor            = new Extractor(sourceDal, shortTrendStartTime);
            var transformer          = extractor.Extract(longTrendStartTime);
            var shortTrendArticleIds = transformer.ShortTrendArticleIds;
            var longTrendArticleIds  = transformer.LongTrendArticleIds;

            DisplayArticleIds("Short", shortTrendArticleIds);
            DisplayArticleIds("Long", longTrendArticleIds);

            Save(destinationDal, shortTrendArticleIds, longTrendArticleIds);
        }