public void Initialize() { unityContainer = new UnityContainer(); unityContainer.RegisterInstance <IFileRepository>(respositoryInstance); unityContainer.RegisterType <IHarvesterTasks, MockTaskScheduler>(); unityContainer.RegisterInstance <ILog>(log); OrgsHandler.Clean(); respositoryInstance.Clean(); OrgsHandler.Initialize(unityContainer); }
public void Initialize() { unityContainer = new UnityContainer(); unityContainer.RegisterInstance <IFileRepository>(respositoryInstance) .RegisterInstance <IHarvesterTasks>(new LimitedConcurrencyHarvesterTasks()) .RegisterType <ITAGProcessorClient, MockRaptor>(); unityContainer.RegisterInstance <ILog>(log); OrgsHandler.Clean(); OrgsHandler.TagFileSubmitterTasksTimeout = TimeSpan.FromMinutes(5); respositoryInstance.Clean(); OrgsHandler.Initialize(unityContainer); }
public static void Start() { log.LogDebug("TagFileHarvester.Start: Entered Start()"); //register dependencies here OrgsHandler.Initialize(new UnityContainer().RegisterType <IFileRepository, FileRepository>() .RegisterInstance <IHarvesterTasks>(new LimitedConcurrencyHarvesterTasks()) .RegisterInstance(log)); //here we need to sync filespaces and tasks SyncTimer = new Timer(OrgsHandler.CheckAvailableOrgs); SyncTimer.Change(TimeSpan.FromMinutes(3), TimeSpan.FromMilliseconds(0)); log.LogDebug("TagFileHarvester.Start: Running on multiple threads"); }
public Task StartAsync(CancellationToken cancellationToken) { OrgsHandler.MaxThreadsToProcessTagFiles = config.GetValueInt("MaxThreadsToProcessTagFiles"); OrgsHandler.tccSynchFilespaceShortName = config.GetValueString("TCCSynchFilespaceShortName"); OrgsHandler.tccSynchMachineFolder = config.GetValueString("TCCSynchMachineControlFolder"); OrgsHandler.TCCSynchProductionDataFolder = config.GetValueString("TCCSynchProductionDataFolder"); OrgsHandler.TCCSynchProductionDataArchivedFolder = config.GetValueString("TCCSynchProductionDataArchivedFolder"); OrgsHandler.TCCSynchProjectBoundaryIssueFolder = config.GetValueString("TCCSynchProjectBoundaryIssueFolder"); OrgsHandler.TCCSynchSubscriptionIssueFolder = config.GetValueString("TCCSynchSubscriptionIssueFolder"); OrgsHandler.TCCSynchOtherIssueFolder = config.GetValueString("TCCSynchOtherIssueFolder"); OrgsHandler.TagFilesFolderLifeSpanInDays = (byte)config.GetValueInt("TagFilesFolderLifeSpanInDays"); OrgsHandler.TagFileSubmitterTasksTimeout = (TimeSpan)config.GetValueTimeSpan("TagFileSubmitterTasksTimeout"); OrgsHandler.TCCRequestTimeout = (TimeSpan)config.GetValueTimeSpan("TCCRequestTimeout"); OrgsHandler.NumberOfFilesInPackage = config.GetValueInt("NumberOfFilesInPackage"); OrgsHandler.OrgProcessingDelay = (TimeSpan)config.GetValueTimeSpan("OrgProcessingDelay"); OrgsHandler.CacheEnabled = (bool)config.GetValueBool("CacheEnabled"); OrgsHandler.FilenameDumpEnabled = (bool)config.GetValueBool("FilenameDumpEnabled"); OrgsHandler.ShortOrgName = config.GetValueString("ShortOrgName"); OrgsHandler.TagFileEndpoint = config.GetValueString("TagFileEndpoint"); OrgsHandler.newrelic = config.GetValueString("newrelic"); ServicePointManager.DefaultConnectionLimit = 8; Log.LogDebug("TagFileHarvester.Start: Entered Start()"); var container = new UnityContainer().RegisterType <IFileRepository, FileRepository>() .RegisterInstance <IHarvesterTasks>(new LimitedConcurrencyHarvesterTasks()) .RegisterInstance(Log); //register dependencies here OrgsHandler.Initialize(container); FileRepository.Log = Log; //here we need to sync filespaces and tasks SyncTimer = new Timer(OrgsHandler.CheckAvailableOrgs); SyncTimer.Change(TimeSpan.FromSeconds(5), (TimeSpan)config.GetValueTimeSpan("RefreshOrgsDelay")); Log.LogInformation("TagFileHarvester.Started."); return(Task.CompletedTask); }