Class ConcurrencyLimitOptions

Namespace
Kevlar
Assembly
Kevlar.dll

Configuration for a concurrency limit (concurrency limiter) strategy: at most MaxConcurrency executions run at once, with up to QueueLimit more waiting; anything beyond that is rejected immediately.

public sealed class ConcurrencyLimitOptions
Inheritance
ConcurrencyLimitOptions
Inherited Members

Remarks

When an execution is rejected, rejection metrics are recorded and OnRejected runs and is awaited. Callback failures are reported through OnCallbackError and do not replace the rejection.

Constructors

ConcurrencyLimitOptions()

public ConcurrencyLimitOptions()

Properties

MaxConcurrency

Maximum concurrent executions. Default 10.

public int MaxConcurrency { get; set; }

Property Value

int

Name

An optional low-cardinality name used by strategy telemetry.

public string? Name { get; set; }

Property Value

string

OnRejected

Invoked and awaited when an execution is rejected. Return default from a synchronous callback.

public Func<ConcurrencyLimitRejectedEvent, ValueTask>? OnRejected { get; set; }

Property Value

Func<ConcurrencyLimitRejectedEvent, ValueTask>

QueueLimit

Maximum executions allowed to wait for a slot. Default 0 (reject immediately when full). Set QueueTimeout to bound queue residence independently of execution time.

public int QueueLimit { get; set; }

Property Value

int

QueueTimeout

Maximum time spent waiting in the queue. Null (the default) leaves the wait unbounded. Must be positive and at most 4,294,967,294 milliseconds when configured. This limit ends when execution is admitted and does not bound execution time.

public TimeSpan? QueueTimeout { get; set; }

Property Value

TimeSpan?

UsePriorityQueue

Enables highest-priority-first queue admission using KevlarKeys.Priority, with FIFO ties. Unset priorities are zero. A higher-priority arrival evicts the newest lowest-priority waiter when the queue is full. Default false preserves the ordinary queue behavior.

public bool UsePriorityQueue { get; set; }

Property Value

bool