public AzureStorageDurabilityProviderFactory( IOptions <DurableTaskOptions> options, IConnectionStringResolver connectionStringResolver) { this.options = options.Value; this.azureStorageOptions = new AzureStorageOptions(); JsonConvert.PopulateObject(JsonConvert.SerializeObject(this.options.StorageProvider), this.azureStorageOptions); this.azureStorageOptions.Validate(); this.connectionStringResolver = connectionStringResolver ?? throw new ArgumentNullException(nameof(connectionStringResolver)); this.defaultConnectionName = this.azureStorageOptions.ConnectionStringName ?? ConnectionStringNames.Storage; }
public AzureStorageDurabilityProvider( AzureStorageOrchestrationService service, string connectionName, AzureStorageOptions options) : base("Azure Storage", service, service, connectionName) { this.serviceClient = service; this.connectionName = connectionName; this.storageOptionsJson = JObject.FromObject( options, new JsonSerializer { Converters = { new StringEnumConverter() }, ContractResolver = new CamelCasePropertyNamesContractResolver(), }); }
public AzureStorageDurabilityProviderFactory( IOptions <DurableTaskOptions> options, IConnectionStringResolver connectionStringResolver, INameResolver nameResolver, ILoggerFactory loggerFactory, #pragma warning disable CS0612 // Type or member is obsolete IPlatformInformationService platformInfo) #pragma warning restore CS0612 // Type or member is obsolete { this.options = options.Value; this.nameResolver = nameResolver; this.loggerFactory = loggerFactory; this.azureStorageOptions = new AzureStorageOptions(); this.inConsumption = platformInfo.InConsumption(); // The consumption plan has different performance characteristics so we provide // different defaults for key configuration values. int maxConcurrentOrchestratorsDefault = this.inConsumption ? 5 : 10 * Environment.ProcessorCount; int maxConcurrentActivitiesDefault = this.inConsumption ? 10 : 10 * Environment.ProcessorCount; if (this.inConsumption) { if (platformInfo.IsPython()) { this.azureStorageOptions.ControlQueueBufferThreshold = 32; } else { this.azureStorageOptions.ControlQueueBufferThreshold = 128; } } // The following defaults are only applied if the customer did not explicitely set them on `host.json` this.options.MaxConcurrentOrchestratorFunctions = this.options.MaxConcurrentOrchestratorFunctions ?? maxConcurrentOrchestratorsDefault; this.options.MaxConcurrentActivityFunctions = this.options.MaxConcurrentActivityFunctions ?? maxConcurrentActivitiesDefault; // Override the configuration defaults with user-provided values in host.json, if any. JsonConvert.PopulateObject(JsonConvert.SerializeObject(this.options.StorageProvider), this.azureStorageOptions); var logger = loggerFactory.CreateLogger(nameof(this.azureStorageOptions)); this.azureStorageOptions.Validate(logger); this.connectionStringResolver = connectionStringResolver ?? throw new ArgumentNullException(nameof(connectionStringResolver)); this.defaultConnectionName = this.azureStorageOptions.ConnectionStringName ?? ConnectionStringNames.Storage; }
public AzureStorageDurabilityProviderFactory( IOptions <DurableTaskOptions> options, IConnectionStringResolver connectionStringResolver) { this.options = options.Value; this.azureStorageOptions = new AzureStorageOptions(); JsonConvert.PopulateObject(JsonConvert.SerializeObject(this.options.StorageProvider), this.azureStorageOptions); this.azureStorageOptions.Validate(); if (!this.options.IsDefaultHubName()) { this.azureStorageOptions.ValidateHubName(this.options.HubName); } else if (!this.azureStorageOptions.IsSanitizedHubName(this.options.HubName, out string sanitizedHubName)) { this.options.SetDefaultHubName(sanitizedHubName); } this.connectionStringResolver = connectionStringResolver; this.defaultConnectionName = this.azureStorageOptions.ConnectionStringName ?? ConnectionStringNames.Storage; this.defaultSettings = this.GetAzureStorageOrchestrationServiceSettings(); }