generated from mauroservienti/code-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecoverabilitySnippets.cs
40 lines (36 loc) · 1.18 KB
/
RecoverabilitySnippets.cs
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
using Mattox.NServiceBus.Tests;
using NServiceBus;
namespace Snippets;
public class RecoverabilitySnippets
{
public void AutoRateLimiting(LearningEndpoint endpoint)
{
// begin-snippet: AutoRateLimitingCallbacks
endpoint.Recoverability.OnRateLimitStarted(token => Task.CompletedTask);
endpoint.Recoverability.OnRateLimitEnded(token => Task.CompletedTask);
// end-snippet
}
public void Failed(LearningEndpoint endpoint)
{
// begin-snippet: FailedMessageCustomization
endpoint.Recoverability.OnFailedMessage(settings =>
{
settings.HeaderCustomization(headers =>
{
// Customize failed message headers
});
});
// end-snippet
}
public void CustomPolicy(LearningEndpoint endpoint)
{
// begin-snippet: CustomRecoverabilityPolicy
endpoint.Recoverability.UseCustomRecoverabilityPolicy(((config, context) =>
{
// Use the configuration and the context
// to decide how to handle the failing message
return RecoverabilityAction.ImmediateRetry();
}));
// end-snippet
}
}