示例#1
0
        public static void Main()
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Build();

            var logConfiguration = new LogConfiguration();

            configuration.GetSection("LogConfiguration").Bind(logConfiguration);
            LogManager.Configure(logConfiguration);

            Log.Info("Starting worker...");
            using (var container = ContainerSetup.Create(configuration))
            {
                // eager load the singleton, so that is starts consuming messages
                var messageBus = container.Resolve <IMessageBus>();
                Log.Info("Worker ready");

                Console.WriteLine("Press enter to stop the application...");
                Console.ReadLine();

                Log.Info("Stopping worker...");
            }
            Log.Info("Worker stopped");
        }
示例#2
0
        static void Main(string[] args)
        {
            Log.Info("Starting worker...");
            using (var container = ContainerSetup.Create())
            {
                var messagBus = container.Resolve <IMessageBus>();
                Log.Info("Worker ready");


                Console.WriteLine("Press enter to stop the application...");
                Console.ReadLine();

                Log.Info("Stopping worker...");
            }
            Log.Info("Worker stopped");
        }
示例#3
0
        public static void Main()
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Build();

            var loggerFactory = LoggerFactory.Create(cfg => cfg.AddConfiguration(configuration.GetSection("Logging")).AddConsole());
            var logger        = loggerFactory.CreateLogger <Program>();

            logger.LogInformation("Starting worker...");
            using (var container = ContainerSetup.Create(configuration, loggerFactory))
            {
                // eager load the singleton, so that is starts consuming messages
                var messageBus = container.Resolve <IMessageBus>();
                logger.LogInformation("Worker ready");

                Console.WriteLine("Press enter to stop the application...");
                Console.ReadLine();

                logger.LogInformation("Stopping worker...");
            }
            logger.LogInformation("Worker stopped");
        }