public static void CrawlAuditTrails(IOutputFactory outFactory, CancellationToken token) { var crawlInvoker = new AuditTrailCrawler(outFactory); IAuditTrailCrawler crawler = new DBCrawler(); if (crawler.IsDisabled) { return; } var supressions = CxAnalytix.Configuration.Config.GetConfig <CxAuditTrailSupressions>(CxAuditTrailSupressions.SECTION_NAME); foreach (var field in typeof(CxAuditTrailTableNameConsts).GetFields()) { if (token.IsCancellationRequested) { break; } if (GetPropertyValue <CxAuditTrailSupressions, bool>(field.Name, supressions)) { _log.Debug($"{field.Name} logging has been suppressed via configuration."); continue; } crawlInvoker.InvokeCrawlMethod(field.Name, crawler, token); } }
public static void CrawlAuditTrails(CancellationToken token) { var crawlInvoker = new AuditTrailCrawler(); IAuditTrailCrawler crawler = new DBCrawler(); if (crawler.IsDisabled) { return; } var supressions = Configuration.Config.GetConfig <CxAuditTrailSupressions>(CxAuditTrailSupressions.SECTION_NAME); using (var trx = Output.StartTransaction()) { Parallel.ForEach(typeof(CxAuditTrailTableNameConsts).GetFields(), new ParallelOptions { CancellationToken = token, MaxDegreeOfParallelism = Configuration.Config.Service.ConcurrentThreads }, (field) => { if (token.IsCancellationRequested) { return; } if (GetPropertyValue <CxAuditTrailSupressions, bool>(field.Name, supressions)) { _log.Debug($"{field.Name} logging has been suppressed via configuration."); return; } crawlInvoker.InvokeCrawlMethod(field.Name, crawler, trx, token); }); if (!token.IsCancellationRequested && trx.Commit()) { crawlInvoker.WriteSinceDate(); } } }