public ExtractionRequestQueueConsumer( CohortExtractorOptions options, IExtractionRequestFulfiller fulfiller, IAuditExtractions auditor, IProjectPathResolver pathResolver, IProducerModel fileMessageProducer, IProducerModel fileMessageInfoProducer) { _options = options; _fulfiller = fulfiller; _auditor = auditor; _resolver = pathResolver; _fileMessageProducer = fileMessageProducer; _fileMessageInfoProducer = fileMessageInfoProducer; }
/// <summary> /// Connects to RDMP platform databases to retrieve extractable catalogues and initializes the <see cref="IExtractionRequestFulfiller"/> (if none /// was specified in the constructor override). /// </summary> /// <param name="repositoryLocator"></param> private void InitializeExtractionSources(IRDMPPlatformRepositoryServiceLocator repositoryLocator) { // Get all extractable catalogues ICatalogue[] catalogues = repositoryLocator .DataExportRepository .GetAllObjects <ExtractableDataSet>() .Select(eds => eds.Catalogue) .ToArray(); if (_auditor == null) { _auditor = ObjectFactory.CreateInstance <IAuditExtractions>(_consumerOptions.AuditorType, typeof(IAuditExtractions).Assembly, repositoryLocator); } if (_auditor == null) { throw new Exception("No IAuditExtractions set"); } if (!_consumerOptions.AllCatalogues) { catalogues = catalogues.Where(c => _consumerOptions.OnlyCatalogues.Contains(c.ID)).ToArray(); } if (_fulfiller == null) { _fulfiller = ObjectFactory.CreateInstance <IExtractionRequestFulfiller>(_consumerOptions.RequestFulfillerType, typeof(IExtractionRequestFulfiller).Assembly, new object[] { catalogues }); } if (_fulfiller == null) { throw new Exception("No IExtractionRequestFulfiller set"); } if (!string.IsNullOrWhiteSpace(_consumerOptions.ModalityRoutingRegex)) { _fulfiller.ModalityRoutingRegex = new Regex(_consumerOptions.ModalityRoutingRegex); } if (!string.IsNullOrWhiteSpace(_consumerOptions.RejectorType)) { _fulfiller.Rejectors.Add(ObjectFactory.CreateInstance <IRejector>(_consumerOptions.RejectorType, typeof(IRejector).Assembly)); } if (_consumerOptions.RejectColumnInfos != null) { foreach (var id in _consumerOptions.RejectColumnInfos) { _fulfiller.Rejectors.Add(new ColumnInfoValuesRejector(repositoryLocator.CatalogueRepository.GetObjectByID <ColumnInfo>(id))); } } if (_consumerOptions.Blacklists != null) { foreach (int id in _consumerOptions.Blacklists) { var cata = repositoryLocator.CatalogueRepository.GetObjectByID <Catalogue>(id); var rejector = new BlacklistRejector(cata); _fulfiller.Rejectors.Add(rejector); } } if (!string.IsNullOrWhiteSpace(_consumerOptions.ProjectPathResolverType)) { _pathResolver = ObjectFactory.CreateInstance <IProjectPathResolver>(_consumerOptions.ProjectPathResolverType, typeof(IProjectPathResolver).Assembly, repositoryLocator); } else { _pathResolver = new DefaultProjectPathResolver(); } }