コード例 #1
0
ファイル: Program.cs プロジェクト: ahives/MassTransit-Quartz
        static int Main()
        {
            Log4NetLogWriterFactory.Use("log4net.config");
            Log4NetLogger.Use();

            return((int)HostFactory.Run(x => x.Service(CreateService)));
        }
コード例 #2
0
        static void Main(string[] args)
        {
            ConfigureLogger();

            // Topshelf to use Log4Net
            Log4NetLogWriterFactory.Use();

            // MassTransit to use Log4Net
            Log4NetLogger.Use();

            var container = IocConfig.RegisterDependencies();


            HostFactory.Run(cfg =>
            {
                cfg.UseUnityContainer(container);

                cfg.Service <ClientService>(s =>
                {
                    s.ConstructUsingUnityContainer();
                    s.WhenStarted((service, cfg) => service.Start(cfg));
                    s.WhenStopped((service, cfg) => service.Stop(cfg));
                });
            });
        }
コード例 #3
0
        static void BootstrapLogger()
        {
            Log4NetLogger.Use(typeof(Program).Namespace + ".log4net.xml");
            Log4NetLogWriterFactory.Use();

            _log.Info("Loading " + typeof(Program).Namespace + " Services...");
        }
コード例 #4
0
        public void UseLog4Net()
        {
            // Topshelf to use Log4Net
            Log4NetLogWriterFactory.Use();

            // MassTransit to use Log4Net
            Log4NetLogger.Use();
        }
コード例 #5
0
        static int Main(string[] args)
        {
            XmlConfigurator.Configure();
            Log4NetLogWriterFactory.Use();
            Log4NetLogger.Use();

            return((int)HostFactory.Run(x => x.Service <StateMachineService>()));
        }
コード例 #6
0
        static int Main(string[] args)
        {
            ConfigureLogger();

            Log4NetLogWriterFactory.Use();

            Log4NetLogger.Use();

            return((int)HostFactory.Run(x => x.Service <RequestService>()));
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: qquser/Project1
        static int Main(string[] args)
        {
            ConfigureLogger();
            // Topshelf to use Log4Net
            Log4NetLogWriterFactory.Use();

            // MassTransit to use Log4Net
            Log4NetLogger.Use();

            return((int)HostFactory.Run(x => x.Service <InformerService>()));
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: jacobpovar/MassTransit
        static void SetupLogger()
        {
            var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MassTransit.Host.log4net.config"));

            if (configFile.Exists)
            {
                XmlConfigurator.ConfigureAndWatch(configFile);
            }

            Log4NetLogWriterFactory.Use();
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: virajs/Demo-Registration
        static int Main()
        {
            ConfigureLogger();

            // Topshelf to use Log4Net
            Log4NetLogWriterFactory.Use();

            // MassTransit to use Log4Net
            Log4NetLogger.Use();

            return((int)HostFactory.Run(x => x.Service <RegistrationService>()));
        }
コード例 #10
0
        static int Main()
        {
            Log4NetLogWriterFactory.Use("log4net.config");
            Log4NetLogger.Use();

            return((int)HostFactory.Run(x =>
            {
                x.RunAsNetworkService();

                x.Service <MemberService>();
            }));
        }
コード例 #11
0
        private static int Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            // Topshelf to use Log4Net
            Log4NetLogWriterFactory.Use();

            StartStatusService();

            int result = ConfigureAndRunServiceHost();

            return(result);
        }
コード例 #12
0
        static int Main()
        {
            Log4NetLogger.Use("worker.log4net.config");
            Log4NetLogWriterFactory.Use();

            return((int)HostFactory.Run(c =>
            {
                c.SetServiceName("Grid.Distributor.Worker");

                c.RunAsLocalSystem();

                c.Service <WorkerService>();
            }));
        }
コード例 #13
0
        /// <summary>
        ///   Specify that you want to use the Log4net logging engine.
        /// </summary>
        /// <param name="configurator"> </param>
        /// <param name="configFileName"> The name of the log4net xml configuration file </param>
        public static void UseLog4Net(this HostConfigurator configurator, string configFileName)
        {
            Log4NetLogWriterFactory.Use();

            string path = AppDomain.CurrentDomain.BaseDirectory;

            string file = Path.Combine(path, configFileName);

            var configFile = new FileInfo(file);

            if (configFile.Exists)
            {
                Log4NetLogWriterFactory.Use(file);
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: waqashaneef/Riktig
        static void ConfigureLog4Net()
        {
            string file       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config");
            var    configFile = new FileInfo(file);

            if (configFile.Exists)
            {
                XmlConfigurator.ConfigureAndWatch(configFile);
            }
            else
            {
                BasicConfigurator.Configure();
            }

            Log4NetLogWriterFactory.Use();
            Log4NetLogger.Use();
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: emretiryaki/QuartzService
 static void Main(string[] args)
 {
     Log4NetLogWriterFactory.Use("log4net.config");
     HostFactory.Run(x =>
     {
         x.Service <HostService>(s =>
         {
             s.ConstructUsing(name => new HostService());
             s.WhenStarted(tc => tc.Start());
             s.WhenStopped(tc => tc.Stop());
         });
         x.RunAsLocalSystem();
         x.SetDescription("Scheduler Service");
         x.SetDisplayName("SchedulerService");
         x.SetServiceName("SchedulerService");
     });
 }
コード例 #16
0
        static void SetupLogger()
        {
            var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MassTransit.Host.log4net.config"));

            if (configFile.Exists)
            {
            #if NETCORE
                var logRepository = LogManager.GetRepository(System.Reflection.Assembly.GetEntryAssembly());
                XmlConfigurator.Configure(logRepository, configFile);
            #else
                XmlConfigurator.Configure(configFile);
            #endif
            }

            Log4NetLogWriterFactory.Use();
            Log4NetLogger.Use();
        }
コード例 #17
0
        static void Main(string[] args)
        {
            Log4NetLogWriterFactory.Use();
            XmlConfigurator.Configure();

            HostFactory.Run(x =>
            {
                x.Service <GreetingServer>(s =>
                {
                    s.ConstructUsing(name => new GreetingServer());
                    s.WhenStarted(tc => tc.Start());
                    s.WhenStopped(tc => tc.Stop());
                });
                x.StartAutomatically();
                x.RunAsLocalSystem();
                x.SetDescription("A greeting service");
                x.SetDisplayName("Greeting Service");
                x.SetServiceName("GreetingService");
            });
        }
コード例 #18
0
        public static int Main()
        {
            Log4NetLogWriterFactory.Use("log4net.config");


            return((int)HostFactory.Run(x =>
            {
                x.AfterInstall(() =>
                {
                    VerifyEventLogSourceExists();

                    // this will force the performance counters to register during service installation
                    // making them created - of course using the InstallUtil stuff completely skips
                    // this part of the install :(
                    new WindowsPerformanceCounterInstaller().Install();
                });

                x.Service(CreateService);
            }));
        }
コード例 #19
0
        static void Main(string[] args)
        {
            BaseCabinetUrl = ConfigurationManager.AppSettings["BaseCabinetUrl"];
            BaseWorkerUrl  = ConfigurationManager.AppSettings["BaseWorkerUrl"];

            ConfigureLogger();

            // Topshelf to use Log4Net
            Log4NetLogWriterFactory.Use();

            // MassTransit to use Log4Net
            Log4NetLogger.Use();

            HostFactory.Run(x => x.Service <RequestService>());

            /*string h = UnityConfig.GetConfiguredContainer().Resolve<IEmailTemplateService>()
             *  .GetEmailBody(new UserRequestAppEventSubscribeDTO {RequestId = 20456}, "RequestAppEvent");
             * Console.WriteLine(h);*/

            Console.ReadKey();
        }
コード例 #20
0
        static int Main(string[] args)
        {
            // Loads the config from our App.config
            XmlConfigurator.Configure();

            // Topshelf to use Log4Net
            Log4NetLogWriterFactory.Use();

            // MassTransit to use Log4Net
            Log4NetLogger.Use();

            // Ioc Helper method for Autofac
            var container = IocConfig.RegisterDependencies();

            return((int)HostFactory.Run(cfg =>
            {
                cfg.Service(s => container.Resolve <MyService>());

                cfg.RunAsLocalSystem();
            }));
        }
コード例 #21
0
        static int Main()
        {
            Log4NetLogWriterFactory.Use("log4net.config");
            Log4NetLogger.Use();


            return((int)HostFactory.Run(x =>
            {
                x.AfterInstall(() =>
                {
                    VerifyEventLogSourceExists();

                    // this will force the performance counters to register during service installation
                    // making them created - of course using the InstallUtil stuff completely skips
                    // this part of the install :(
                    ServiceBusPerformanceCounters counters = ServiceBusPerformanceCounters.Instance;

                    string name = counters.ConsumerThreadCount.Name;
                    Console.WriteLine("Consumer Thread Count Counter Installed: {0}", name);
                });

                x.Service(CreateService);
            }));
        }
コード例 #22
0
 /// <summary>
 ///   Specify that you want to use the Log4net logging engine.
 /// </summary>
 /// <param name="configurator"> </param>
 /// <param name="configFileName"> The name of the log4net xml configuration file </param>
 /// <param name="watchFile"> Should log4net watch the config file? </param>
 public static void UseLog4Net(this HostConfigurator configurator, string configFileName, bool watchFile)
 {
     Log4NetLogWriterFactory.Use(configFileName, watchFile);
 }
コード例 #23
0
        static int Main()
        {
            Log4NetLogWriterFactory.Use("log4net.config");
            Log4NetLogger.Use();

            string username            = "******";
            string password            = "******";
            var    serviceBusUri       = new Uri("rabbitmq://localhost/stress_service");
            ushort heartbeat           = 3;
            int    iterations          = 1000;
            int    instances           = 10;
            int    requestsPerInstance = 1;
            int    messageSize         = 128;
            int    prefetchCount       = 10;
            int    consumerLimit       = 10;
            string test    = "stress";
            bool   cleanup = true;
            bool   mixed   = false;
            string debug   = null;


            int workerThreads;
            int completionPortThreads;

            ThreadPool.GetMinThreads(out workerThreads, out completionPortThreads);
            ThreadPool.SetMinThreads(Math.Max(workerThreads, 100), completionPortThreads);

            return((int)HostFactory.Run(x =>
            {
                x.SetDescription("Generates a stressful load on RabbitMQ using MassTransit");
                x.SetDisplayName("MassTransit RabbitMQ Stress Console");
                x.SetServiceName("MassTransitStressConsole");

                x.AddCommandLineDefinition("rmqusername", v => username = v);
                x.AddCommandLineDefinition("rmqpassword", v => password = v);
                x.AddCommandLineDefinition("uri", v => serviceBusUri = new Uri(v));
                x.AddCommandLineDefinition("heartbeat", v => heartbeat = ushort.Parse(v));
                x.AddCommandLineDefinition("iterations", v => iterations = int.Parse(v));
                x.AddCommandLineDefinition("instances", v => instances = int.Parse(v));
                x.AddCommandLineDefinition("prefetch", v => prefetchCount = int.Parse(v));
                x.AddCommandLineDefinition("threads", v => consumerLimit = int.Parse(v));
                x.AddCommandLineDefinition("requests", v => requestsPerInstance = int.Parse(v));
                x.AddCommandLineDefinition("test", v => test = v);
                x.AddCommandLineDefinition("size", v => messageSize = int.Parse(v));
                x.AddCommandLineDefinition("cleanup", v => cleanup = bool.Parse(v));
                x.AddCommandLineDefinition("mixed", v => mixed = bool.Parse(v));
                x.AddCommandLineDefinition("debug", v => debug = v);
                x.ApplyCommandLine();

                x.Service(hostSettings =>
                {
                    if (!string.IsNullOrWhiteSpace(debug))
                    {
                        EnableDebug(debug);
                    }

                    if (test == "ingest")
                    {
                        return new SelectService(new StressIngestService(serviceBusUri, username, password, heartbeat,
                                                                         iterations, instances, messageSize, cleanup, mixed, prefetchCount, consumerLimit));
                    }


                    return new SelectService(new StressService(serviceBusUri, username, password, heartbeat,
                                                               iterations, instances, messageSize, cleanup, mixed, prefetchCount, consumerLimit, requestsPerInstance));
                });
            }));
        }
コード例 #24
0
 /// <summary>
 ///   Specify that you want to use the Log4net logging engine.
 /// </summary>
 /// <param name="configurator"> </param>
 public static void UseLog4Net(this HostConfigurator configurator)
 {
     Log4NetLogWriterFactory.Use();
 }