4. Combining Policies to Protect Against Many Types of Failure Flashcards

1
Q

What does wrapping allow us to do in regards to resilience?

A

They allow us to combine multiple layers of resilience when calling a remote service.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does wrapping mean for us when it comes to code readability?

A

Wrapping can help us make our code shorter and easier to read.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does wrapping offer us in terms of code reuse?

A

It encourages the reuse of combinations of policies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which one does wrapping work with — generic or non-generic policies?

A

Both.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What can be said about wrapping policies when it comes to policy interfaces?

A

Wrapping can be used with policy interfaces instead of concrete types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s can be said about the syntactical difference between wrapping generic policies vs wrapping them together with non-generic policies?

A

Wrapping generic policies is less complex, whereas wrapping them together with non-generic policies is slightly more complex.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What interface can you use for policy wraps to be able to unit test them?

A

The IPolicyWrap interface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do we wrap generic policies?

A

By using the Wrap or WrapAsync method (depending on the synchronicity of policies) of the Policy method.

Policy.WrapAsync(
     _fallbackPolicy, _retryPolicy, _timeoutPolicy);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do we wrap generic and non-generic policies together?

A

By using the .Wrap or .WrapAsync method of Policy objects.

_fallbackPolicy
    .WrapAsync(_retryPolicy
        .WrapAsync(_timeoutPolicy));
How well did you know this?
1
Not at all
2
3
4
5
Perfectly