public void Initialize(IConfiguration config) { _processorConfigs = config.GetSection("Processors").Get <List <ProcessorConfig> >(); foreach (var p in _processorConfigs) { var processor = JobProcessorFactory.CreateProcessor(p, _provider); Processors.Add(processor); } }
public IJobProcessor GetProcessor(string id, bool newInstance = false) { IJobProcessor res = null; if (newInstance) { var p = _processorConfigs?.Where(i => i.Id == id).FirstOrDefault(); if (p != null) { var processor = JobProcessorFactory.CreateProcessor(p, _provider); res = processor; } } else { res = Processors?.Where(p => p.Id == id).FirstOrDefault(); } return(res); }