private static IWebJobsBuilder AddDurableTask(this IWebJobsBuilder builder, IOptions <DurableTaskOptions> options, string storageProvider, Type durabilityProviderFactoryType = null)
        {
            if (durabilityProviderFactoryType != null)
            {
                builder.Services.AddSingleton(typeof(IDurabilityProviderFactory), typeof(AzureStorageShortenedTimerDurabilityProviderFactory));
                builder.AddDurableTask(options);
                return(builder);
            }

            switch (storageProvider)
            {
            case TestHelpers.RedisProviderType:
                builder.AddRedisDurableTask();
                break;

            case TestHelpers.EmulatorProviderType:
                builder.AddEmulatorDurableTask();
                break;

            case TestHelpers.AzureStorageProviderType:
                // This provider is built into the default AddDurableTask() call below.
                break;

            default:
                throw new InvalidOperationException($"The DurableTaskOptions of type {options.GetType()} is not supported for tests in Functions V2.");
            }

            builder.AddDurableTask(options);
            return(builder);
        }
Пример #2
0
        /// <summary>
        /// Adds the Durable Task extension to the provided <see cref="IWebJobsBuilder"/>.
        /// </summary>
        /// <param name="builder">The <see cref="IWebJobsBuilder"/> to configure.</param>
        /// <param name="options">The configuration options for this extension.</param>
        /// <returns>Returns the provided <see cref="IWebJobsBuilder"/>.</returns>
        public static IWebJobsBuilder AddDurableTask(this IWebJobsBuilder builder, IOptions <DurableTaskOptions> options)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            builder.AddDurableTask();
            builder.Services.AddSingleton(options);
            return(builder);
        }
Пример #3
0
        /// <summary>
        /// Adds the Durable Task extension to the provided <see cref="IWebJobsBuilder"/>.
        /// </summary>
        /// <param name="builder">The <see cref="IWebJobsBuilder"/> to configure.</param>
        /// <param name="configure">An <see cref="Action{DurableTaskOptions}"/> to configure the provided <see cref="DurableTaskOptions"/>.</param>
        /// <returns>Returns the modified <paramref name="builder"/> object.</returns>
        public static IWebJobsBuilder AddDurableTask(this IWebJobsBuilder builder, Action <DurableTaskOptions> configure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            builder.AddDurableTask();
            builder.Services.Configure(configure);

            return(builder);
        }
        private static IWebJobsBuilder AddDurableTask(this IWebJobsBuilder builder, IOptions <DurableTaskOptions> options, string storageProvider)
        {
            switch (storageProvider)
            {
            case TestHelpers.RedisProviderType:
                builder.AddRedisDurableTask();
                break;

            case TestHelpers.EmulatorProviderType:
                builder.AddEmulatorDurableTask();
                break;

            case TestHelpers.AzureStorageProviderType:
                // This provider is built into the default AddDurableTask() call below.
                break;

            default:
                throw new InvalidOperationException($"The DurableTaskOptions of type {options.GetType()} is not supported for tests in Functions V2.");
            }

            builder.AddDurableTask(options);
            return(builder);
        }
 public void Configure(IWebJobsBuilder builder)
 {
     builder.AddDurableTask();
 }