Пример #1
0
 public EventPublisher(IEventDefinitionService eventDefinitionService, IPointLedgerRepository pointLedgerRepository, IFeedService feedService, IAwardCalculator awardCalculator, IProfileService profileService)
 {
     _eventDefinitionService = eventDefinitionService;
     _pointLedgerRepository  = pointLedgerRepository;
     _feedService            = feedService;
     _awardCalculator        = awardCalculator;
     _profileService         = profileService;
 }
Пример #2
0
		public EventPublisher(IEventDefinitionService eventDefinitionService, IPointLedgerRepository pointLedgerRepository, IFeedService feedService, IAwardCalculator awardCalculator, IProfileService profileService)
		{
			_eventDefinitionService = eventDefinitionService;
			_pointLedgerRepository = pointLedgerRepository;
			_feedService = feedService;
			_awardCalculator = awardCalculator;
			_profileService = profileService;
		}
Пример #3
0
		public void ProcessCalculation(IAwardCalculator calculator, IErrorLog errorLog)
		{
			if (!Monitor.TryEnter(_syncRoot)) return;
			try
			{
				calculator.ProcessOneCalculation();
			}
			catch (Exception exc)
			{
				errorLog.Log(exc, ErrorSeverity.Error);
			}
			finally
			{
				Monitor.Exit(_syncRoot);
			}
		}
Пример #4
0
        public async Task ProcessCalculation(IAwardCalculator calculator, IAwardCalculationQueueRepository awardCalculationQueueRepository, IErrorLog errorLog)
        {
            try
            {
                var nextItem = await awardCalculationQueueRepository.Dequeue();

                if (string.IsNullOrEmpty(nextItem.Key))
                {
                    return;
                }
                await calculator.ProcessCalculation(nextItem.Key, nextItem.Value);
            }
            catch (Exception exc)
            {
                errorLog.Log(exc, ErrorSeverity.Error);
            }
        }
Пример #5
0
 public void ProcessCalculation(IAwardCalculator calculator, IErrorLog errorLog)
 {
     if (!Monitor.TryEnter(_syncRoot))
     {
         return;
     }
     try
     {
         calculator.ProcessOneCalculation();
     }
     catch (Exception exc)
     {
         errorLog.Log(exc, ErrorSeverity.Error);
     }
     finally
     {
         Monitor.Exit(_syncRoot);
     }
 }
Пример #6
0
 public void ProcessCalculation(IAwardCalculator calculator, IAwardCalculationQueueRepository awardCalculationQueueRepository, IErrorLog errorLog)
 {
     if (!Monitor.TryEnter(_syncRoot))
     {
         return;
     }
     try
     {
         var nextItem = awardCalculationQueueRepository.Dequeue();
         if (string.IsNullOrEmpty(nextItem.Key))
         {
             return;
         }
         calculator.ProcessCalculation(nextItem.Key, nextItem.Value);
     }
     catch (Exception exc)
     {
         errorLog.Log(exc, ErrorSeverity.Error);
     }
     finally
     {
         Monitor.Exit(_syncRoot);
     }
 }