Version v1.0 · dotnet

Overview

Start here for a practical, production-safe DurableStack configuration baseline.

Overview

DurableStack configuration is designed to be explicit, predictable, and easy for future developers to reason about.

For most teams, the right approach is:

  • set all important runtime options in C#
  • keep values close to runtime registration in Program.cs
  • tune only after observing behavior in staging/production

Configuration flow

  • Select the storage provider.
  • Set worker identity and polling behavior.
  • Configure retry and lease semantics.
  • Configure recurring job behavior.
  • Add advanced options only when needed.
using DurableStack.Core.Options;
using DurableStack.Hosting.DependencyInjection;

builder.Services.AddDurableStackPostgres(connectionString, options =>
{
    options.WorkerName = $"orders-api-{Environment.MachineName}-{Environment.ProcessId}";
    options.JobActivation = DurableStackJobActivationMode.ScopedPerExecution;

    options.PollIntervalSeconds = 5;
    options.PollJitterEnabled = true;
    options.PollJitterRatio = 0.2;
    options.BatchSize = 50;
    options.MaxConcurrentRuns = 10;
    options.LeaseDurationSeconds = 30;

    options.RetryDelay = TimeSpan.FromSeconds(5);
    options.RetryMaxDelay = TimeSpan.FromMinutes(10);
    options.RetryJitterEnabled = true;
    options.RetryJitterRatio = 0.2;

    options.Recurring.CatchUpPolicy = RecurringCatchUpPolicy.SkipMissed;

    options.Retention.Enabled = true;
    options.Retention.RunRetentionSeconds = 86400;
    options.Retention.SweepIntervalSeconds = 300;
    options.Retention.DeleteBatchSize = 1000;
});

For full option-level details, see Configuration Schema.