public static void Main(string[] args) { // Setup Serilog Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.File($"/logs/analyzer.log", rollingInterval: RollingInterval.Day) .WriteTo.Console() .CreateLogger(); // Setup DI var services = new ServiceCollection(); services.AddLogging(c => c.AddSerilog()); services.AddNodeServices(options => { }); // TODO remove and just use the ML Model! services.AddSingleton <IRabbitEndpoint, RabbitEndpoint>(); services.AddSingleton <IPipeline, RabbitClient>(); services.AddSingleton <IEngine, Engine>(); services.AddSingleton <IMediator, Mediator>(); services.AddSingleton <IMLModel, MLModel>(); services.AddSingleton <IAFINN, AFINN>(); var serviceProvider = services.BuildServiceProvider(); _rabbitEndpoint = serviceProvider.GetRequiredService <IRabbitEndpoint>(); _pipeline = serviceProvider.GetRequiredService <IPipeline>(); var engine = serviceProvider.GetRequiredService <IEngine>(); engine.Init(); // Handle cancel press and SIGTERM AssemblyLoadContext.Default.Unloading += SigTermEventHandler; Console.CancelKeyPress += CancelHandler; _rabbitEndpoint.StartListening(); _pipeline.Open(); }
private void OnStarted() { _rabbitEndpoint.StartListening(); }