Class InflightDrainGuard
Encapsulates inflight tracking and drain-on-stop logic.
Used by both poll-based () and callback-based consumers
(RabbitMQ, MQTT, AMQP, TCP) to avoid duplicating CTS lifecycle + drain + force-cancel boilerplate.
public sealed class InflightDrainGuard : IDisposable
Inheritance
Implements
Properties
DrainTimeout
Drain timeout for graceful stop (default 30s).
public TimeSpan DrainTimeout { get; set; }
ProcessingToken
The processing cancellation token. Valid after .
public CancellationToken ProcessingToken { get; }
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
DrainAsync(CancellationToken, ILogger?, string?)
Drains in-flight exchanges and force-cancels if drain times out.
public Task DrainAsync(CancellationToken ct, ILogger? logger = null, string? consumerName = null)
Start(CancellationToken)
Initializes the processing CTS linked to the application shutdown token.
public void Start(CancellationToken ct = default)