Line data Source code
1 : // Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
2 :
3 : using System;
4 :
5 : namespace Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling
6 : {
7 : /// <summary>
8 : /// Provides extensions to the <see cref="RetryManager"/> class for using the Windows Azure Service Bus retry strategy.
9 : /// </summary>
10 : public static class RetryManagerServiceBusExtensions
11 1 : {
12 : /// <summary>
13 : /// The technology name that can be used to get default Service Bus retry strategy name.
14 : /// </summary>
15 : public const string DefaultStrategyTechnologyName = "ServiceBus";
16 :
17 : /// <summary>
18 : /// Returns the default retry strategy for the Windows Azure Service Bus.
19 : /// </summary>
20 : /// <returns>The default Windows Azure Service Bus retry strategy (or the default strategy if no default for Windows Azure Service Bus could be found).</returns>
21 1 : public static RetryStrategy GetDefaultAzureServiceBusRetryStrategy(this RetryManager retryManager)
22 : {
23 : if (retryManager == null) throw new ArgumentNullException("retryManager");
24 :
25 : return retryManager.GetDefaultRetryStrategy(DefaultStrategyTechnologyName);
26 : }
27 :
28 : /// <summary>
29 : /// Returns the default retry policy dedicated to handling transient conditions with Windows Azure Service Bus.
30 : /// </summary>
31 : /// <returns>The retry policy for Windows Azure Service Bus with the corresponding default strategy (or the default strategy if no retry strategy definition for Windows Azure Service Bus was found).</returns>
32 1 : public static RetryPolicy GetDefaultAzureServiceBusRetryPolicy(this RetryManager retryManager)
33 : {
34 : if (retryManager == null) throw new ArgumentNullException("retryManager");
35 :
36 : return new RetryPolicy(new ServiceBusTransientErrorDetectionStrategy(), retryManager.GetDefaultAzureServiceBusRetryStrategy());
37 : }
38 : }
39 : }
|