Renaming to ResilientHttpClient and StandardHttpClient
This commit is contained in:
parent
2d6796d77b
commit
61df92872a
@ -16,16 +16,16 @@ namespace WebMVC.Services.Utilities
|
|||||||
/// Currently is ONLY implemented for the ASP MVC
|
/// Currently is ONLY implemented for the ASP MVC
|
||||||
/// and Xamarin App
|
/// and Xamarin App
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HttpApiClientWrapper : IHttpClient
|
public class ResilientHttpClient : IHttpClient
|
||||||
{
|
{
|
||||||
private HttpClient _client;
|
private HttpClient _client;
|
||||||
private PolicyWrap _policyWrapper;
|
private PolicyWrap _policyWrapper;
|
||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
public HttpClient Inst => _client;
|
public HttpClient Inst => _client;
|
||||||
public HttpApiClientWrapper()
|
public ResilientHttpClient()
|
||||||
{
|
{
|
||||||
_client = new HttpClient();
|
_client = new HttpClient();
|
||||||
_logger = new LoggerFactory().CreateLogger(nameof(HttpApiClientWrapper));
|
_logger = new LoggerFactory().CreateLogger(nameof(ResilientHttpClient));
|
||||||
|
|
||||||
// Add Policies to be applied
|
// Add Policies to be applied
|
||||||
_policyWrapper = Policy.WrapAsync(
|
_policyWrapper = Policy.WrapAsync(
|
@ -6,15 +6,15 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace WebMVC.Services.Utilities
|
namespace WebMVC.Services.Utilities
|
||||||
{
|
{
|
||||||
public class HttpApiClient : IHttpClient
|
public class StandardHttpClient : IHttpClient
|
||||||
{
|
{
|
||||||
private HttpClient _client;
|
private HttpClient _client;
|
||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
public HttpClient Inst => _client;
|
public HttpClient Inst => _client;
|
||||||
public HttpApiClient()
|
public StandardHttpClient()
|
||||||
{
|
{
|
||||||
_client = new HttpClient();
|
_client = new HttpClient();
|
||||||
_logger = new LoggerFactory().CreateLogger(nameof(HttpApiClientWrapper));
|
_logger = new LoggerFactory().CreateLogger(nameof(ResilientHttpClient));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<string> GetStringAsync(string uri) =>
|
public Task<string> GetStringAsync(string uri) =>
|
@ -60,11 +60,11 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
|
|
||||||
if(Configuration.GetValue<string>("ActivateCircuitBreaker") == bool.TrueString)
|
if(Configuration.GetValue<string>("ActivateCircuitBreaker") == bool.TrueString)
|
||||||
{
|
{
|
||||||
services.AddTransient<IHttpClient, HttpApiClientWrapper>();
|
services.AddTransient<IHttpClient, ResilientHttpClient>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
services.AddTransient<IHttpClient, HttpApiClient>();
|
services.AddTransient<IHttpClient, StandardHttpClient>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user