protected override void OnStart(string[] args) { mErrorsInARow = 0; // Deserialize configuration from XML try { var serializer = new XmlSerializer(typeof(ServiceConfiguration)); using (var reader = new StreamReader(Environment.ExpandEnvironmentVariables(CONFIGURATION_PATH))) { Configuration = (ServiceConfiguration)serializer.Deserialize(reader); } Sender = new RestSender(Configuration.Rest, Logger); Sender.OnError += Stop; Sender.OnSuccess += () => { mErrorsInARow = 0; }; Dispatcher = new ChangesDispatcher(Sender, Configuration.UserAttributesBindings, Configuration.GroupAttributesBindings, Logger); Dispatcher.OnError += OnListenerError; } catch (Exception ex) { Logger.LogError("Exception occured during configuration parsing.", ex); } StartListening(); Logger.LogMessage("Listener Service has been successfully started."); }
protected override void OnStart(string[] args) { mErrorsInARow = 0; // Deserialize configuration from XML try { var serializer = new XmlSerializer(typeof(ServiceConfiguration)); using (var reader = new StreamReader(Environment.ExpandEnvironmentVariables(CONFIGURATION_PATH))) { Configuration = (ServiceConfiguration)serializer.Deserialize(reader); } Sender = new RestSender(Configuration.Rest, Logger); Sender.OnError += Stop; Sender.OnSuccess += () => { mErrorsInARow = 0; }; Dispatcher = new ChangesDispatcher(Sender, Configuration.UserAttributesBindings, Configuration.GroupAttributesBindings, Logger); Dispatcher.OnError += OnListenerError; } catch (Exception ex) { Logger.LogError("Exception occured during configuration parsing.", ex); } StartListening(); Logger.LogMessage("Listener Service has been successfully started."); }