/// <summary> /// Starts the adapter. /// This method returns immediately leaving to a background worker /// the task of getting the data and process it. /// /// Throws an exception if it can't initialise itself. /// </summary> public void Start() { try { LogVersions(); _logger.Info("Adapter is connecting to the UDAPI service..."); UDAPIService.Connect(); if (!UDAPIService.IsConnected) { return; } _logger.Debug("Adapter connected to the UDAPI - initialising..."); foreach (var sport in UDAPIService.GetSports()) { _sports.Add(sport.Name); } _fixtureManager = new FixtureManager(Settings.FixtureCreationConcurrency, _listenersManager, UDAPIService.GetResources); _trigger = new Timer(timerAutoEvent => TimerEvent(), null, 0, Settings.FixtureCheckerFrequency); _logger.InfoFormat("Adapter started"); _stats.SetValue(AdapterCoreKeys.ADAPTER_STARTED, "1"); } catch (Exception ex) { _logger.Fatal("A fatal error has occurred and the Adapater cannot start. You can try a manual restart", ex); throw; } }
/// <summary> /// Starts the adapter. /// This method returns immediately leaving to a background worker /// the task of getting the data and process it. /// /// Throws an exception if it can't initialise itself. /// </summary> public void Start() { try { LogVersions(); _logger.Info("Adapter is connecting to the UDAPI service..."); UDAPIService.Connect(); if (!UDAPIService.IsConnected) return; _logger.Debug("Adapter connected to the UDAPI - initialising..."); foreach (var sport in UDAPIService.GetSports()) { _sports.Add(sport.Name); } _fixtureManager = new FixtureManager(Settings.FixtureCreationConcurrency, _listenersManager, UDAPIService.GetResources); _trigger = new Timer(timerAutoEvent => TimerEvent(), null, 0, Settings.FixtureCheckerFrequency); _logger.InfoFormat("Adapter started"); _stats.SetValue(AdapterCoreKeys.ADAPTER_STARTED, "1"); } catch (Exception ex) { _logger.Fatal("A fatal error has occurred and the Adapater cannot start. You can try a manual restart", ex); throw; } }