Example #1
0
        private AzureStorageDurabilityProvider GetAzureStorageStorageProvider(DurableClientAttribute attribute)
        {
            string connectionName = attribute.ConnectionName ?? this.defaultConnectionName;
            AzureStorageOrchestrationServiceSettings settings = this.GetAzureStorageOrchestrationServiceSettings(connectionName, attribute.TaskHub);

            AzureStorageDurabilityProvider innerClient;

            // Need to check this.defaultStorageProvider != null for external clients that call GetDurabilityProvider(attribute)
            // which never initializes the defaultStorageProvider.
            if (string.Equals(this.defaultSettings?.TaskHubName, settings.TaskHubName, StringComparison.OrdinalIgnoreCase) &&
                string.Equals(this.defaultSettings?.StorageConnectionString, settings.StorageConnectionString, StringComparison.OrdinalIgnoreCase) &&
                this.defaultStorageProvider != null)
            {
                // It's important that clients use the same AzureStorageOrchestrationService instance
                // as the host when possible to ensure we any send operations can be picked up
                // immediately instead of waiting for the next queue polling interval.
                innerClient = this.defaultStorageProvider;
            }
            else
            {
                ILogger logger = this.loggerFactory.CreateLogger(LoggerName);
                innerClient = new AzureStorageDurabilityProvider(
                    new AzureStorageOrchestrationService(settings),
                    connectionName,
                    this.azureStorageOptions,
                    logger);
            }

            return(innerClient);
        }
        private AzureStorageDurabilityProvider GetAzureStorageStorageProvider(DurableClientAttribute attribute)
        {
            string connectionName = attribute.ConnectionName ?? this.defaultConnectionName;
            AzureStorageOrchestrationServiceSettings settings = this.GetAzureStorageOrchestrationServiceSettings(connectionName, attribute.TaskHub);

            AzureStorageDurabilityProvider innerClient;

            if (string.Equals(this.defaultSettings.TaskHubName, settings.TaskHubName, StringComparison.OrdinalIgnoreCase) &&
                string.Equals(this.defaultSettings.StorageConnectionString, settings.StorageConnectionString, StringComparison.OrdinalIgnoreCase))
            {
                // It's important that clients use the same AzureStorageOrchestrationService instance
                // as the host when possible to ensure we any send operations can be picked up
                // immediately instead of waiting for the next queue polling interval.
                innerClient = this.defaultStorageProvider;
            }
            else
            {
                innerClient = new AzureStorageDurabilityProvider(
                    new AzureStorageOrchestrationService(settings),
                    connectionName,
                    this.azureStorageOptions);
            }

            return(innerClient);
        }
        public DurabilityProvider GetDurabilityProvider()
        {
            if (this.defaultStorageProvider == null)
            {
                var defaultService = new AzureStorageOrchestrationService(this.defaultSettings);
                this.defaultStorageProvider = new AzureStorageDurabilityProvider(defaultService, this.defaultConnectionName);
            }

            return(this.defaultStorageProvider);
        }
        public DurabilityProvider GetDurabilityProvider()
        {
            this.EnsureInitialized();
            if (this.defaultStorageProvider == null)
            {
                var defaultService = new AzureStorageOrchestrationService(this.defaultSettings);
                this.defaultStorageProvider = new AzureStorageDurabilityProvider(
                    defaultService,
                    this.defaultConnectionName,
                    this.azureStorageOptions);
            }

            return(this.defaultStorageProvider);
        }
Example #5
0
        public virtual DurabilityProvider GetDurabilityProvider()
        {
            this.EnsureDefaultClientSettingsInitialized();
            if (this.defaultStorageProvider == null)
            {
                var     defaultService = new AzureStorageOrchestrationService(this.defaultSettings);
                ILogger logger         = this.loggerFactory.CreateLogger(LoggerName);
                this.defaultStorageProvider = new AzureStorageDurabilityProvider(
                    defaultService,
                    this.defaultConnectionName,
                    this.azureStorageOptions,
                    logger);
            }

            return(this.defaultStorageProvider);
        }