Health check for Payment
This commit is contained in:
		
							parent
							
								
									202e663f77
								
							
						
					
					
						commit
						926cc9f5e5
					
				@ -137,6 +137,7 @@ services:
 | 
			
		||||
      - IdentityUrl=http://identity.api/hc
 | 
			
		||||
      - LocationsUrl=http://locations.api/hc
 | 
			
		||||
      - MarketingUrl=http://marketing.api/hc
 | 
			
		||||
      - PaymentUrl=http://payment.api/hc
 | 
			
		||||
      - mvc=http://webmvc/hc
 | 
			
		||||
      - spa=http://webspa/hc
 | 
			
		||||
    ports:
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,7 @@ namespace Payment.API
 | 
			
		||||
 | 
			
		||||
        public static IWebHost BuildWebHost(string[] args) =>
 | 
			
		||||
            WebHost.CreateDefaultBuilder(args)
 | 
			
		||||
               
 | 
			
		||||
                .UseHealthChecks("/hc")
 | 
			
		||||
                .UseContentRoot(Directory.GetCurrentDirectory())
 | 
			
		||||
                .UseStartup<Startup>()
 | 
			
		||||
                .ConfigureLogging((hostingContext, builder) =>
 | 
			
		||||
 | 
			
		||||
@ -9,11 +9,13 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
 | 
			
		||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.Extensions.HealthChecks;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
using Payment.API.IntegrationEvents.EventHandling;
 | 
			
		||||
using Payment.API.IntegrationEvents.Events;
 | 
			
		||||
using RabbitMQ.Client;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Payment.API
 | 
			
		||||
{
 | 
			
		||||
@ -70,6 +72,11 @@ namespace Payment.API
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            services.AddHealthChecks(checks =>
 | 
			
		||||
            {
 | 
			
		||||
                checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask<IHealthCheckResult>(HealthCheckResult.Healthy("Ok")));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            RegisterEventBus(services);
 | 
			
		||||
 | 
			
		||||
            services.AddSwaggerGen(options =>
 | 
			
		||||
 | 
			
		||||
@ -40,6 +40,7 @@ namespace WebStatus
 | 
			
		||||
                checks.AddUrlCheckIfNotNull(Configuration["IdentityUrl"], TimeSpan.FromMinutes(minutes));
 | 
			
		||||
                checks.AddUrlCheckIfNotNull(Configuration["LocationsUrl"], TimeSpan.FromMinutes(minutes)); 
 | 
			
		||||
                checks.AddUrlCheckIfNotNull(Configuration["MarketingUrl"], TimeSpan.FromMinutes(minutes));
 | 
			
		||||
                checks.AddUrlCheckIfNotNull(Configuration["PaymentUrl"], TimeSpan.FromMinutes(minutes));
 | 
			
		||||
                checks.AddUrlCheckIfNotNull(Configuration["mvc"], TimeSpan.FromMinutes(minutes));
 | 
			
		||||
                checks.AddUrlCheckIfNotNull(Configuration["spa"], TimeSpan.FromMinutes(minutes));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
@ -10,5 +10,6 @@
 | 
			
		||||
  "CatalogUrl": "http://localhost:5101/hc",
 | 
			
		||||
  "IdentityUrl": "http://localhost:5105/hc",
 | 
			
		||||
  "MarketingUrl": "http://localhost:5110/hc",
 | 
			
		||||
  "LocationsUrl": "http://localhost:5109/hc"
 | 
			
		||||
  "LocationsUrl": "http://localhost:5109/hc",
 | 
			
		||||
  "PaymentUrl": "http://localhost:5108/hc"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user