| | | 1 | | namespace AsyncResponse; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Faults a waiter's <see cref="IAsyncResponseWaiter{T}.ResponseTask"/> when disposal abandoned an |
| | | 5 | | /// in-flight delivery without learning its outcome: the drain of a dispatch that had already |
| | | 6 | | /// claimed a message — typically an <c>Until</c> predicate still running user code — did not finish |
| | | 7 | | /// within the channel's <c>DisposalDrainTimeout</c>. The response may or may not have been consumed |
| | | 8 | | /// from the channel. |
| | | 9 | | /// <para> |
| | | 10 | | /// This is deliberately <em>not</em> a cancellation. A canceled response task tells the caller |
| | | 11 | | /// "nothing was delivered", which invites re-attaching to the correlation id — and if the wedged |
| | | 12 | | /// delivery had consumed the message, that re-attached wait can never be answered. Treat the |
| | | 13 | | /// awaiting step as indeterminate and restart it fresh (steps are idempotent); |
| | | 14 | | /// <c>DurableFlowContext</c> does so automatically through its faulted-wait path. |
| | | 15 | | /// </para> |
| | | 16 | | /// </summary> |
| | | 17 | | public sealed class AsyncResponseIndeterminateDeliveryException : Exception |
| | | 18 | | { |
| | | 19 | | /// <summary>Runs the AsyncResponseIndeterminateDeliveryException operation.</summary> |
| | | 20 | | public AsyncResponseIndeterminateDeliveryException(string? correlationId, TimeSpan drainTimeout) |
| | 3 | 21 | | : base($"Disposal abandoned an in-flight response delivery for correlationId '{correlationId}' " + |
| | 3 | 22 | | $"after draining for {drainTimeout.TotalSeconds:0.###}s. The response may already have been " + |
| | 3 | 23 | | "consumed from the channel; treat delivery as indeterminate and restart the awaiting " + |
| | 3 | 24 | | "(idempotent) step instead of re-attaching to this correlation id.") |
| | | 25 | | { |
| | 3 | 26 | | CorrelationId = correlationId; |
| | 3 | 27 | | } |
| | | 28 | | |
| | | 29 | | /// <summary>The correlation id whose delivery outcome is unknown.</summary> |
| | | 30 | | public string? CorrelationId { get; } |
| | | 31 | | } |