This repository was archived by the owner on Nov 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +12
-2
lines changed
Services/Payment/Payment.API Expand file tree Collapse file tree 5 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ services:
137137 - IdentityUrl=http://identity.api/hc
138138 - LocationsUrl=http://locations.api/hc
139139 - MarketingUrl=http://marketing.api/hc
140+ - PaymentUrl=http://payment.api/hc
140141 - mvc=http://webmvc/hc
141142 - spa=http://webspa/hc
142143 ports :
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public static void Main(string[] args)
1515
1616 public static IWebHost BuildWebHost ( string [ ] args ) =>
1717 WebHost . CreateDefaultBuilder ( args )
18-
18+ . UseHealthChecks ( "/hc" )
1919 . UseContentRoot ( Directory . GetCurrentDirectory ( ) )
2020 . UseStartup < Startup > ( )
2121 . ConfigureLogging ( ( hostingContext , builder ) =>
Original file line number Diff line number Diff line change 99using Microsoft . eShopOnContainers . BuildingBlocks . EventBusServiceBus ;
1010using Microsoft . Extensions . Configuration ;
1111using Microsoft . Extensions . DependencyInjection ;
12+ using Microsoft . Extensions . HealthChecks ;
1213using Microsoft . Extensions . Logging ;
1314using Payment . API . IntegrationEvents . EventHandling ;
1415using Payment . API . IntegrationEvents . Events ;
1516using RabbitMQ . Client ;
1617using System ;
18+ using System . Threading . Tasks ;
1719
1820namespace Payment . API
1921{
@@ -70,6 +72,11 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
7072 } ) ;
7173 }
7274
75+ services . AddHealthChecks ( checks =>
76+ {
77+ checks . AddValueTaskCheck ( "HTTP Endpoint" , ( ) => new ValueTask < IHealthCheckResult > ( HealthCheckResult . Healthy ( "Ok" ) ) ) ;
78+ } ) ;
79+
7380 RegisterEventBus ( services ) ;
7481
7582 services . AddSwaggerGen ( options =>
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ public void ConfigureServices(IServiceCollection services)
4040 checks . AddUrlCheckIfNotNull ( Configuration [ "IdentityUrl" ] , TimeSpan . FromMinutes ( minutes ) ) ;
4141 checks . AddUrlCheckIfNotNull ( Configuration [ "LocationsUrl" ] , TimeSpan . FromMinutes ( minutes ) ) ;
4242 checks . AddUrlCheckIfNotNull ( Configuration [ "MarketingUrl" ] , TimeSpan . FromMinutes ( minutes ) ) ;
43+ checks . AddUrlCheckIfNotNull ( Configuration [ "PaymentUrl" ] , TimeSpan . FromMinutes ( minutes ) ) ;
4344 checks . AddUrlCheckIfNotNull ( Configuration [ "mvc" ] , TimeSpan . FromMinutes ( minutes ) ) ;
4445 checks . AddUrlCheckIfNotNull ( Configuration [ "spa" ] , TimeSpan . FromMinutes ( minutes ) ) ;
4546 } ) ;
Original file line number Diff line number Diff line change 1010 "CatalogUrl" : " http://localhost:5101/hc" ,
1111 "IdentityUrl" : " http://localhost:5105/hc" ,
1212 "MarketingUrl" : " http://localhost:5110/hc" ,
13- "LocationsUrl" : " http://localhost:5109/hc"
13+ "LocationsUrl" : " http://localhost:5109/hc" ,
14+ "PaymentUrl" : " http://localhost:5108/hc"
1415}
You can’t perform that action at this time.
0 commit comments