| | | 1 | | namespace AsyncResponse; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Common options for durable flows (<see cref="IDurableFlows"/>), configured on the selected |
| | | 5 | | /// <c>With*DurableFlows(...)</c> registration. Provider option types derive from this class so |
| | | 6 | | /// flow-engine and state-store settings live in one configuration block. |
| | | 7 | | /// </summary> |
| | | 8 | | public class DurableFlowOptions |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// How long persisted flow state lives; the TTL is refreshed on every checkpoint, so it bounds |
| | | 12 | | /// the *idle* time of a run, not its total duration. Must comfortably exceed the longest gap |
| | | 13 | | /// between checkpoints (typically the longest awaited step) — the default is deliberately |
| | | 14 | | /// double the 7-day default step-timeout chain (<see cref="DefaultStepTimeout"/> → |
| | | 15 | | /// channel <c>DefaultTimeout</c> → <c>RecoveryStateExpiry</c>), so a step that waits out the |
| | | 16 | | /// full default timeout still faults and checkpoints before its ledger can expire, instead of |
| | | 17 | | /// racing it. Default: 14 days. |
| | | 18 | | /// </summary> |
| | 3 | 19 | | public TimeSpan StateExpiry { get; set; } = TimeSpan.FromDays(14); |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Default timeout for awaited steps that don't pass one explicitly. <c>null</c> uses the |
| | | 23 | | /// configured channel's default wait timeout. |
| | | 24 | | /// </summary> |
| | | 25 | | public TimeSpan? DefaultStepTimeout { get; set; } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Distributed execution-lease duration. A worker renews the lease while flow code is running; |
| | | 29 | | /// another replica may take over after this interval if the worker disappears. Default: 1 minute. |
| | | 30 | | /// </summary> |
| | 3 | 31 | | public TimeSpan ExecutionLeaseDuration { get; set; } = TimeSpan.FromMinutes(1); |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// How often an active execution renews its lease. Must be shorter than |
| | | 35 | | /// <see cref="ExecutionLeaseDuration"/>. Default: 20 seconds. |
| | | 36 | | /// </summary> |
| | 3 | 37 | | public TimeSpan ExecutionLeaseRenewInterval { get; set; } = TimeSpan.FromSeconds(20); |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Minimum interval between persistence writes made only by <c>ReportProgressAsync</c>. |
| | | 41 | | /// Reports inside the interval update the in-memory flow state and are coalesced into the next |
| | | 42 | | /// checkpoint or flow outcome. Set to zero to persist every report. Default: 1 second. |
| | | 43 | | /// </summary> |
| | 3 | 44 | | public TimeSpan ProgressPersistenceInterval { get; set; } = TimeSpan.FromSeconds(1); |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Accepts the risk of running the worker subscriber in early ACK (<c>AckAfterEnqueue</c>) |
| | | 48 | | /// while durable flows are registered, suppressing the startup error. Durable-flow wake-ups |
| | | 49 | | /// ride the worker queue and rely on broker redelivery for crash recovery; with early ACK, a |
| | | 50 | | /// process crash after the ACK but before execution strands the run as <c>Running</c> with no |
| | | 51 | | /// lease and no queued job, and only an operator <c>ResumeAsync(flowId)</c> can revive it. |
| | | 52 | | /// Leave <c>false</c> (the default) unless that loss mode is acceptable. Default: false. |
| | | 53 | | /// </summary> |
| | | 54 | | public bool AllowEarlyAckWorkerSubscriber { get; set; } |
| | | 55 | | } |