internal AzureStorageOrchestrationServiceSettings GetAzureStorageOrchestrationServiceSettings()

in src/WebJobs.Extensions.DurableTask/AzureStorageDurabilityProviderFactory.cs [185:245]


        internal AzureStorageOrchestrationServiceSettings GetAzureStorageOrchestrationServiceSettings(
            string connectionName = null,
            string taskHubNameOverride = null)
        {
            TimeSpan extendedSessionTimeout = TimeSpan.FromSeconds(
                Math.Max(this.options.ExtendedSessionIdleTimeoutInSeconds, 0));

            var settings = new AzureStorageOrchestrationServiceSettings
            {
                StorageAccountClientProvider = this.clientProviderFactory.GetClientProvider(connectionName ?? this.DefaultConnectionName),
                TaskHubName = taskHubNameOverride ?? this.options.HubName,
                PartitionCount = this.azureStorageOptions.PartitionCount,
                ControlQueueBatchSize = this.azureStorageOptions.ControlQueueBatchSize,
                ControlQueueBufferThreshold = this.azureStorageOptions.ControlQueueBufferThreshold,
                ControlQueueVisibilityTimeout = this.azureStorageOptions.ControlQueueVisibilityTimeout,
                WorkItemQueueVisibilityTimeout = this.azureStorageOptions.WorkItemQueueVisibilityTimeout,
                MaxConcurrentTaskOrchestrationWorkItems = this.options.MaxConcurrentOrchestratorFunctions ?? throw new InvalidOperationException($"{nameof(this.options.MaxConcurrentOrchestratorFunctions)} needs a default value"),
                MaxConcurrentTaskActivityWorkItems = this.options.MaxConcurrentActivityFunctions ?? throw new InvalidOperationException($"{nameof(this.options.MaxConcurrentOrchestratorFunctions)} needs a default value"),
                MaxConcurrentTaskEntityWorkItems = this.options.MaxConcurrentEntityFunctions ?? throw new InvalidOperationException($"{nameof(this.options.MaxConcurrentEntityFunctions)} needs a default value"),
                ExtendedSessionsEnabled = this.options.ExtendedSessionsEnabled,
                ExtendedSessionIdleTimeout = extendedSessionTimeout,
                MaxQueuePollingInterval = this.azureStorageOptions.MaxQueuePollingInterval,
                TrackingServiceClientProvider = this.azureStorageOptions.TrackingStoreConnectionName != null
                    ? this.clientProviderFactory.GetTrackingClientProvider(this.azureStorageOptions.TrackingStoreConnectionName)
                    : null,
                FetchLargeMessageDataEnabled = this.azureStorageOptions.FetchLargeMessagesAutomatically,
                ThrowExceptionOnInvalidDedupeStatus = true,
                UseAppLease = this.options.UseAppLease,
                AppLeaseOptions = this.options.AppLeaseOptions,
                AppName = EndToEndTraceHelper.LocalAppName,
                LoggerFactory = this.loggerFactory,
                UseLegacyPartitionManagement = this.azureStorageOptions.UseLegacyPartitionManagement,
                UseTablePartitionManagement = this.azureStorageOptions.UseTablePartitionManagement,
                UseSeparateQueueForEntityWorkItems = this.useSeparateQueueForEntityWorkItems,
                EntityMessageReorderWindowInMinutes = this.options.EntityMessageReorderWindowInMinutes,
                MaxEntityOperationBatchSize = this.options.MaxEntityOperationBatchSize,
                AllowReplayingTerminalInstances = this.azureStorageOptions.AllowReplayingTerminalInstances,
                PartitionTableOperationTimeout = this.azureStorageOptions.PartitionTableOperationTimeout,
            };

            if (this.inConsumption)
            {
                settings.MaxStorageOperationConcurrency = 25;
            }

            // When running on App Service VMSS stamps, these environment variables are the best way
            // to enure unqique worker names
            string stamp = this.nameResolver.Resolve("WEBSITE_CURRENT_STAMPNAME");
            string roleInstance = this.nameResolver.Resolve("RoleInstanceId");
            if (!string.IsNullOrEmpty(stamp) && !string.IsNullOrEmpty(roleInstance))
            {
                settings.WorkerId = $"{stamp}:{roleInstance}";
            }

            if (!string.IsNullOrEmpty(this.azureStorageOptions.TrackingStoreNamePrefix))
            {
                settings.TrackingStoreNamePrefix = this.azureStorageOptions.TrackingStoreNamePrefix;
            }

            return settings;
        }