Esempio n. 1
0
        private static int Run(Options opts)
        {
            Console.CancelKeyPress += Console_CancelKeyPress;

            _logger = LogManager.GetCurrentClassLogger();

            var buildVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();

            LogSetup.ConfigureLogger("tsanalyser", opts.OrganizationId, opts.DescriptorTags, "https://telemetry.cinegy.com", opts.TelemetryEnabled, false, "TSAnalyser", buildVersion);

            _analyser = new Analyser(_logger);

            var location = Assembly.GetEntryAssembly().Location;

            _logger.Info($"Cinegy Transport Stream Monitoring and Analysis Tool (Built: {File.GetCreationTime(location)})");

            try
            {
                Console.CursorVisible = false;
                Console.SetWindowSize(120, 50);
                Console.OutputEncoding = Encoding.Unicode;
            }
            catch
            {
                Console.WriteLine("Failed to increase console size - probably screen resolution is low");
            }
            _options = opts;

            GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency;

            WorkLoop();

            return(0);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            LogSetup.ConfigureLogger();

            var akkaConfFile = Environment.GetEnvironmentVariable("AKKA_CONF_FILENAME");

            // Get actor configuration
            using (var reader = new StreamReader(File.OpenRead(akkaConfFile ?? "akka.conf")))
            {
                var config = ConfigurationFactory.ParseString(reader.ReadToEnd());

                // Join the cluster
                using (var system = ActorSystem.Create("dockka-system", config))
                {
                    var container = DependencyInjection.ConfigureDependencyInjection();
                    container.RegisterType <AddPersonActor>();
                    var propsResolver = new AutoFacDependencyResolver(container.Build(), system);

                    // Start the actor
                    system.ActorOf(system.DI().Props <AddPersonActor>(), "addPerson");

                    // Wait indefinitely
                    if (string.IsNullOrEmpty(akkaConfFile))
                    {
                        Console.ReadKey();
                    }
                    else
                    {
                        Thread.Sleep(Timeout.Infinite);
                    }
                }
            }
        }
Esempio n. 3
0
 public static void Main(string[] args)
 {
     // Configure logging from Serilog to sink to Logstash
     // Logstash is an ingestor of logs, and inserts those to elasticsearch
     LogSetup.ConfigureLogger();
     // Elasticsearch can be viewed via kibana dashboard at localhost:5601
     try
     {
         Log.Information("Starting web host");
         var webHost = BuildWebHost(args);
         AkkaSystem = BuildAkkaCluster(webHost);
         webHost.Run();
     }
     catch (Exception ex)
     {
         Log.Fatal(ex, "Host terminated unexpectedly");
     }
     finally
     {
         Log.CloseAndFlush();
     }
 }