private TelemetriaOptions ConfiguraTelemetria(IServiceCollection services) { var telemetriaOptions = new TelemetriaOptions(); Configuration.GetSection(TelemetriaOptions.Secao).Bind(telemetriaOptions, c => c.BindNonPublicProperties = true); services.AddSingleton(telemetriaOptions); return(telemetriaOptions); }
public WorkerRabbitMQ(IConnection conexaoRabbit, IServiceScopeFactory serviceScopeFactory, IMetricReporter metricReporter, ServicoTelemetria servicoTelemetria, ConsumoDeFilasOptions consumoDeFilasOptions, ConfiguracaoRabbitOptions configuracaoRabbitOptions, TelemetriaOptions telemetriaOptions, IMediator mediator) { this.conexaoRabbit = conexaoRabbit ?? throw new ArgumentNullException(nameof(conexaoRabbit)); this.serviceScopeFactory = serviceScopeFactory ?? throw new ArgumentNullException(nameof(serviceScopeFactory)); this.telemetriaOptions = telemetriaOptions ?? throw new ArgumentNullException(nameof(telemetriaOptions)); this.mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); this.metricReporter = metricReporter; this.servicoTelemetria = servicoTelemetria ?? throw new ArgumentNullException(nameof(servicoTelemetria)); this.consumoDeFilasOptions = consumoDeFilasOptions ?? throw new ArgumentNullException(nameof(consumoDeFilasOptions)); this.configuracaoRabbitOptions = configuracaoRabbitOptions ?? throw new ArgumentNullException(nameof(configuracaoRabbitOptions)); comandos = new Dictionary <string, ComandoRabbit>(); RegistrarUseCases(); }