private void Run() { var settings = BuildConfig(); try { SetupRequirements(settings); _logger.LogInformation($"Metrics endpoint configured: <host>:{settings.Metrics_port}/metrics"); } catch (HttpListenerException e) { _logger.LogWarning("Metrics endpoint not configured, try to run the program with administrative permission"); } catch (Exception ex) { _logger.LogWarning($"Error while configuring metrics endpoint: {ex.GetBaseException().Message}"); } _logger.LogInformation("Starting Backend Component"); Adapter.Worker endpoint = BuildWorkerUsingEventStore(settings); if (!endpoint.Start()) { throw new Exception("Fatal error while starting the endpoint"); } _logger.LogInformation("Started Backend Component"); }
private static Adapter.Worker BuildWorkerUsingEventStore(Settings settings) { string queue = GetQueueName(settings); var subscriberFromEventStore = new MessageReceiverFromEventStore(BuilderForSubscriber(settings), queue, $"{settings.DomainCategory}-processors"); var endpoint = new Adapter.Worker(BuildDomainRepositories(settings), subscriberFromEventStore, settings); return(endpoint); }