示例#1
0
        private static ObjectId GetLastId(ArticleTrendingEventsDal dal, string displayAdjective)
        {
            var id = dal.GetLastId();

            Console.WriteLine($"Last {displayAdjective} event ID: '{id}'");
            return(id);
        }
示例#2
0
        public void GetAllSince_ShouldReturnSomething()
        {
            // Arrange
            var dal  = new ArticleTrendingEventsDal(Config, TrendingDatabase.Reporting);
            var from = DateTime.UtcNow.AddDays(-5);

            // Act
            var documents = dal.GetAllSince(from);

            // Assert
            documents.Should().NotBeNullOrEmpty("there should be something in the source copy");
        }
示例#3
0
        // TODO: Index timestamp!
        // See e.g.: https://stackoverflow.com/questions/17807577/how-to-create-indexes-in-mongodb-via-net
        private static void Main()
        {
            Console.WriteLine($"Scheduled job: Trending Query Service ETL - SOURCE COPIER - (c) Gustin AG 2020 {Environment.NewLine}");

            var reportingDal   = new ArticleTrendingEventsDal(Config, TrendingDatabase.Reporting);
            var operationalDal = new ArticleTrendingEventsDal(Config, TrendingDatabase.Operational);

            var copyStatus = new CopyStatus(operationalDal, reportingDal);

            copyStatus.Check();

            var copier = new Copier(operationalDal, reportingDal, copyStatus);

            copier.CopyNewEvents();
        }
        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);
        }
示例#5
0
 internal CopyStatus(ArticleTrendingEventsDal operationalDal, ArticleTrendingEventsDal reportingDal)
 {
     _operationalDal = operationalDal;
     _reportingDal   = reportingDal;
 }
 internal Extractor(ArticleTrendingEventsDal dal, DateTime shortTrendStartTime)
 {
     _dal = dal;
     _shortTrendStartTime = shortTrendStartTime;
 }
示例#7
0
 internal Copier(ArticleTrendingEventsDal operationalDal, ArticleTrendingEventsDal reportingDal, CopyStatus status)
 {
     _operationalDal = operationalDal;
     _reportingDal   = reportingDal;
     _status         = status;
 }