public EventPublisher(IEventDefinitionService eventDefinitionService, IPointLedgerRepository pointLedgerRepository, IFeedService feedService, IAwardCalculator awardCalculator, IProfileService profileService) { _eventDefinitionService = eventDefinitionService; _pointLedgerRepository = pointLedgerRepository; _feedService = feedService; _awardCalculator = awardCalculator; _profileService = profileService; }
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); } }
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); } }
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); } }
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); } }