2017-03-31 14:20:03 +02:00
|
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.HttpResilience.Policies;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.HttpResilience
|
|
|
|
|
{
|
2017-04-04 13:19:22 -07:00
|
|
|
|
public static class ResiliencePolicyFactory
|
2017-03-31 14:20:03 +02:00
|
|
|
|
{
|
2017-04-04 13:19:22 -07:00
|
|
|
|
public static ResiliencePolicy CreateRetryPolicy(int retries, int backoffSeconds, bool exponentialBackoff)
|
2017-03-31 14:20:03 +02:00
|
|
|
|
{
|
|
|
|
|
return new RetryPolicy(retries, backoffSeconds, exponentialBackoff);
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-04 13:19:22 -07:00
|
|
|
|
public static ResiliencePolicy CreateCiscuitBreakerPolicy(int exceptionsAllowedBeforeBreaking, int durationOfBreakInMinutes)
|
2017-03-31 14:20:03 +02:00
|
|
|
|
{
|
|
|
|
|
return new CircuitBreakerPolicy(exceptionsAllowedBeforeBreaking, durationOfBreakInMinutes);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|