Esempio n. 1
0
        // ReSharper disable once UnusedParameter.Local
        public static void Main(string[] args)
        {
            try
            {
                LogConfiguration.Initialize(LogConfiguration.Source.File);
                Logger.LogInfo("Launching Program", nameof(args), string.Join(",", args));

                Initialize();
                IocContainer.Resolve <IAllZipCodesProcessor>().Process();

                Logger.LogInfo("Ending program", "Result", true);
                LogConfiguration.Shutdown();
            }
            catch (Exception ex)
            {
                Logger.LogError("Ending program", ex, "Result", false);
                LogConfiguration.Shutdown();
                throw;
            }
        }
Esempio n. 2
0
        public bool Start(HostControl hostControl)
        {
            using (var scope = _container.BeginLifetimeScope())
            {
                // retrieve the log4net configuration and configure logging
                LogConfiguration.Initialize(scope.Resolve <ILog4NetConfiguration>());

                _logger.Info($"Starting service '{nameof(UserService)}'");

                var userEventListener = scope.Resolve <UserEventListener>();
                _tasks.Add(Task.Factory.StartNew(() => userEventListener.Run(_eventListenerCancellationTokenSource.Token)));
                var userSequentialEventListener = scope.Resolve <UserSequentialEventListener>();
                _tasks.Add(Task.Factory.StartNew(() => userSequentialEventListener.Run(_eventListenerCancellationTokenSource.Token)));
                var userAggregateEventListener = scope.Resolve <UserAggregateEventListener>();
                _tasks.Add(Task.Factory.StartNew(() => userAggregateEventListener.Run(_eventListenerCancellationTokenSource.Token)));

                _logger.Info($"Started service '{nameof(UserService)}'");
            }

            return(true);
        }