-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBreakEvent.cs
More file actions
53 lines (46 loc) · 1.65 KB
/
BreakEvent.cs
File metadata and controls
53 lines (46 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
namespace DotNet.Sdk.Extensions.Polly.Http.CircuitBreaker.Events;
/// <summary>
/// Contains the event data when the circuit transitions to an <see cref="CircuitState.Open"/> state.
/// </summary>
public sealed class BreakEvent
{
internal BreakEvent(
string httpClientName,
CircuitBreakerOptions circuitBreakerOptions,
DelegateResult<HttpResponseMessage> lastOutcome,
CircuitState previousState,
TimeSpan durationOfBreak,
Context context)
{
HttpClientName = httpClientName;
CircuitBreakerOptions = circuitBreakerOptions;
LastOutcome = lastOutcome;
PreviousState = previousState;
DurationOfBreak = durationOfBreak;
Context = context;
}
/// <summary>
/// Gets the name of the HttpClient that triggered this event.
/// </summary>
public string HttpClientName { get; }
/// <summary>
/// Gets the circuit breaker options applied to the HttpClient that triggered this event.
/// </summary>
public CircuitBreakerOptions CircuitBreakerOptions { get; }
/// <summary>
/// Gets result from the last HttpClient execution before the circuit state changed to open/isolated.
/// </summary>
public DelegateResult<HttpResponseMessage> LastOutcome { get; }
/// <summary>
/// Gets the circuit's previous state.
/// </summary>
public CircuitState PreviousState { get; }
/// <summary>
/// Gets the duration the circuit will stay open before resetting.
/// </summary>
public TimeSpan DurationOfBreak { get; }
/// <summary>
/// Gets the Polly Context.
/// </summary>
public Context Context { get; }
}