public MassTransitHostedService(IBusControl bus, ILoggerFactory loggerFactory, SimplifiedBusHealthCheck simplifiedBusCheck, ReceiveEndpointHealthCheck receiveEndpointCheck) { _bus = bus; _simplifiedBusCheck = simplifiedBusCheck; _receiveEndpointCheck = receiveEndpointCheck; if (loggerFactory != null && Logging.Logger.Current.GetType() == typeof(TraceLogger)) { ExtensionsLoggingIntegration.ExtensionsLogger.Use(loggerFactory); } }
static void AddSimplifiedHostedService(this IServiceCollection services, Action <HealthCheckOptions> configureHealthChecks) { var busCheck = new SimplifiedBusHealthCheck(); var receiveEndpointCheck = new ReceiveEndpointHealthCheck(); var healthCheckOptions = HealthCheckOptions.Default; configureHealthChecks?.Invoke(healthCheckOptions); services.AddHealthChecks() .AddCheck(healthCheckOptions.BusHealthCheckName, busCheck, healthCheckOptions.FailureStatus, healthCheckOptions.Tags) .AddCheck(healthCheckOptions.ReceiveEndpointHealthCheckName, receiveEndpointCheck, healthCheckOptions.FailureStatus, healthCheckOptions.Tags); services.AddSingleton <IHostedService>(p => { var bus = p.GetRequiredService <IBusControl>(); return(new MassTransitHostedService(bus, busCheck, receiveEndpointCheck)); }); }
public MassTransitHostedService(IBusControl bus, SimplifiedBusHealthCheck simplifiedBusCheck, ReceiveEndpointHealthCheck receiveEndpointCheck) { _bus = bus; _simplifiedBusCheck = simplifiedBusCheck; _receiveEndpointCheck = receiveEndpointCheck; }