private void ProcessTickersTask()
        {
            _isProcTaskRunning = true;
            while (_etlList.Count > 0)
            {
                List <long> tickerIds = new List <long>();
                lock (_lockEtlList)
                {
                    // Running ETL task
                    tickerIds.AddRange(_etlList);
                    _etlList.Clear();
                }

                foreach (var tickerId in tickerIds)
                {
                    try
                    {
                        IQuotesDalProcessTickerParams paramsProcessTicker = _dal.CreateProcessTickerParams();
                        paramsProcessTicker.Type     = "ETL";
                        paramsProcessTicker.TickerId = tickerId;

                        var resProcessFiling = _dal.ProcessTicker(paramsProcessTicker);
                    }
                    catch (Exception ex)
                    {
                        _logger.Log(ex);
                    }
                }
            }
            _isProcTaskRunning = false;
        }
        public IQuotesDalProcessTickerResult ProcessTicker(IQuotesDalProcessTickerParams procTickerParams)
        {
            IQuotesDalProcessTickerResult result = new QuotesDalMSSQLProcessTickerResult();

            try
            {
                switch (procTickerParams.Type)
                {
                case "ETL":
                    result = RunTickerETL(procTickerParams.TickerId);
                    break;

                default:
                    result.Errors.Add(new Interfaces.Error()
                    {
                        Code    = Interfaces.EErrorCodes.TickerProcessingFail,
                        Type    = Interfaces.EErrorType.Error,
                        Message = string.Format("Unknown processing type '{0}'", procTickerParams.Type)
                    }
                                      );
                    result.Success = false;
                    break;
                }
            }
            catch (Exception ex)
            {
                result.Errors.Add(new Interfaces.Error()
                {
                    Code    = Interfaces.EErrorCodes.TickerProcessingFail,
                    Type    = Interfaces.EErrorType.Error,
                    Message = ex.Message
                }
                                  );
                result.Success = false;
            }

            return(result);
        }
Ejemplo n.º 3
0
 public IQuotesDalProcessTickerResult ProcessTicker(IQuotesDalProcessTickerParams procTickerParams)
 {
     throw new NotImplementedException();
 }