static void DetectObsoleteConfiguration(SecondLevelRetriesConfig secondLevelRetriesConfig) { if (secondLevelRetriesConfig != null) { throw new NotSupportedException($"The {nameof(SecondLevelRetriesConfig)} configuration section is no longer supported. Remove this from this configuration section. Switch to the code API by using 'endpointConfiguration.Recoverability().Delayed(settings => ...)' instead."); } }
protected override void Setup(FeatureConfigurationContext context) { SecondLevelRetriesConfig retriesConfig = context.Settings.GetConfigSection <SecondLevelRetriesConfig>(); SecondLevelRetryPolicy retryPolicy = new SecondLevelRetryPolicy(retriesConfig.NumberOfRetries, retriesConfig.TimeIncrease); context.Container.RegisterSingleton(typeof(SecondLevelRetryPolicy), retryPolicy); context.Pipeline.Register <SecondLevelRetriesBehavior.Registration>(); }
static void SetUpRetryPolicy(SecondLevelRetriesConfig retriesConfig) { if (retriesConfig == null) return; DefaultRetryPolicy.NumberOfRetries = retriesConfig.NumberOfRetries; if (retriesConfig.TimeIncrease != TimeSpan.MinValue) { DefaultRetryPolicy.TimeIncrease = retriesConfig.TimeIncrease; } }
static void SetUpRetryPolicy(SecondLevelRetriesConfig retriesConfig) { if (retriesConfig == null) { return; } DefaultRetryPolicy.NumberOfRetries = retriesConfig.NumberOfRetries; if (retriesConfig.TimeIncrease != TimeSpan.MinValue) { DefaultRetryPolicy.TimeIncrease = retriesConfig.TimeIncrease; } }
public T GetConfiguration <T>() where T : class, new() { if (typeof(T) == typeof(SecondLevelRetriesConfig)) { var config = new SecondLevelRetriesConfig { Enabled = true, NumberOfRetries = 2, TimeIncrease = TimeSpan.FromSeconds(10) }; return(config as T); } // Respect app.config for other sections not defined in this method return(ConfigurationManager.GetSection(typeof(T).Name) as T); }
public T GetConfiguration <T>() where T : class, new() { // To provide SLR Config if (typeof(T) == typeof(SecondLevelRetriesConfig)) { SecondLevelRetriesConfig slrConfig = new SecondLevelRetriesConfig { Enabled = true, NumberOfRetries = 2, TimeIncrease = TimeSpan.FromSeconds(10) }; return(slrConfig as T); } // To in app.config for other sections not defined in this method, otherwise return null. return(ConfigurationManager.GetSection(typeof(T).Name) as T); }
public T GetConfiguration <T>() where T : class, new() { if (typeof(T) == typeof(UnicastBusConfig)) { Debug.WriteLine("Getting UnicastBusConfig"); var config = new UnicastBusConfig(); config.MessageEndpointMappings.Add(new MessageEndpointMapping { AssemblyName = "NSBUnityError.Commands", Namespace = "NSBUnityError.Commands", Endpoint = "NSBUnityError.Host" }); return(config as T); } if (typeof(T) == typeof(TransportConfig)) { Debug.WriteLine("Getting TransportConfig"); var config = new TransportConfig { MaximumConcurrencyLevel = 1, MaxRetries = 3 }; return(config as T); } if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig)) { Debug.WriteLine("Getting MessageForwardingInCaseOfFaultConfig"); var config = new MessageForwardingInCaseOfFaultConfig { ErrorQueue = "error" }; return(config as T); } if (typeof(T) == typeof(SecondLevelRetriesConfig)) { Debug.WriteLine("Getting SecondLevelRetriesConfig"); var config = new SecondLevelRetriesConfig { Enabled = true, NumberOfRetries = 3, TimeIncrease = TimeSpan.FromSeconds(10) }; return(config as T); } if (typeof(T) == typeof(AuditConfig)) { Debug.WriteLine("Getting AuditConfig"); var config = new AuditConfig { QueueName = "audit" }; return(config as T); } if (typeof(T) == typeof(AzureServiceBusQueueConfig)) { Debug.WriteLine("Getting AzureServiceBusQueueConfig"); var config = new AzureServiceBusQueueConfig { ConnectionString = _serviceBusConnectionString }; return(config as T); } return(null); }