Exemplo n.º 1
0
        /// <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...");

                _udapiServiceFacade.Connect();
                if (!_udapiServiceFacade.IsConnected)
                {
                    return;
                }

                _logger.Debug("Adapter connected to the UDAPI - initialising...");

                AdapterActorSystem.Init(
                    _settings,
                    _udapiServiceFacade,
                    _platformConnector,
                    _stateManager,
                    _suspensionManager,
                    _streamHealthCheckValidation,
                    _fixtureValidation);

                _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;
            }
        }