예제 #1
0
        public void RunUnitOfWork(string jobKey)
        {
            var products = _source.GetProducts(_configuration.GetLastSuccessfulRun()).ToList();
            var productsReceivedAtDateTime = DateTime.Now;

            if (products.Any())
            {
                var logBuilder = new StringBuilder();
                logBuilder.AppendLine("Processing " + products.Count + " products.");

                foreach (var product in products)
                {
                    logBuilder.AppendLine(product.ToString());
                }

                _logger.Debug(logBuilder.ToString());

                _destination.SaveProducts(products);
                _configuration.SetLastSuccessfulRun(productsReceivedAtDateTime);
            }
            else
            {
                _logger.Debug("No notifications to run");
            }
        }