private static ObjectId GetLastId(ArticleTrendingEventsDal dal, string displayAdjective) { var id = dal.GetLastId(); Console.WriteLine($"Last {displayAdjective} event ID: '{id}'"); return(id); }
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"); }
// 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); }
internal CopyStatus(ArticleTrendingEventsDal operationalDal, ArticleTrendingEventsDal reportingDal) { _operationalDal = operationalDal; _reportingDal = reportingDal; }
internal Extractor(ArticleTrendingEventsDal dal, DateTime shortTrendStartTime) { _dal = dal; _shortTrendStartTime = shortTrendStartTime; }
internal Copier(ArticleTrendingEventsDal operationalDal, ArticleTrendingEventsDal reportingDal, CopyStatus status) { _operationalDal = operationalDal; _reportingDal = reportingDal; _status = status; }