示例#1
0
        public static HealthChecksBuilder AddHealthChecks(this HttpConfiguration httpConfiguration, string healthEndpoint = "health")
        {
            System.Diagnostics.Debug.WriteLine("Iniciei"); // ToDo: Era para isso estar aqui mesmo?
            var healthChecksBuilder = new HealthChecksBuilder();

            var healthChecksService   = new HealthCheckService(healthChecksBuilder);
            var authenticationService = new AuthenticationService(healthChecksBuilder);

            var dependencyHandler     = new DependencyHandler(httpConfiguration, healthChecksBuilder);
            var authenticationHandler = new AuthenticationHandler(authenticationService);
            var healthCheckHandler    = new HealthCheckHandler(healthChecksService);

            dependencyHandler.SetNextHandler(authenticationHandler);
            authenticationHandler.SetNextHandler(healthCheckHandler);

            httpConfiguration.Routes.MapHttpRoute(
                name: "health_check",
                routeTemplate: healthEndpoint,
                defaults: new { check = RouteParameter.Optional },
                constraints: null,
                handler: dependencyHandler
                );

            return(healthChecksBuilder);
        }
        public static HealthChecksBuilder AddHealthChecks(this HttpConfiguration httpConfiguration, string healthEndpoint = "health")
        {
            var hcBuilder          = new HealthChecksBuilder();
            var dependencyResolver = httpConfiguration.DependencyResolver;
            var hcConfig           = hcBuilder.HealthCheckConfig;


            // Service Instances
            var healthChecksService   = new HealthCheckService(dependencyResolver, hcConfig.HealthChecksDependencies);
            var authenticationService = new AuthenticationService(hcConfig);

            // Handler Instances
            var authenticationHandler = new AuthenticationHandler(hcConfig, authenticationService);
            var healthCheckHandler    = new HealthCheckHandler(hcConfig, healthChecksService);

            // ChainOfResponsibility
            authenticationHandler.SetNextHandler(healthCheckHandler);

            httpConfiguration.Routes.MapHttpRoute(
                name: "health_check",
                routeTemplate: healthEndpoint,
                defaults: new { check = RouteParameter.Optional },
                constraints: null,
                handler: authenticationHandler
                );

            return(hcBuilder);
        }
        public static HealthChecksBuilder AddHealthChecks(this HttpConfiguration httpConfiguration, string healthEndpoint = "health")
        {
            var healthChecksBuilder   = new HealthChecksBuilder();
            var authenticationHandler = new AuthenticationHandler(httpConfiguration, healthChecksBuilder);
            var healthCheckHandler    = new HealthCheckHandler(httpConfiguration, healthChecksBuilder);

            authenticationHandler.SetNextHandler(healthCheckHandler);

            httpConfiguration.Routes.MapHttpRoute(
                name: "health_check",
                routeTemplate: healthEndpoint,
                defaults: new { check = RouteParameter.Optional },
                constraints: null,
                handler: authenticationHandler
                );

            return(healthChecksBuilder);
        }