Table of Contents

Class HandlerTimeoutOptions

Namespace
Excalibur.Dispatch.Middleware.Timeout
Assembly
Excalibur.Dispatch.dll

Configuration options for per-handler timeout middleware.

public sealed class HandlerTimeoutOptions
Inheritance
HandlerTimeoutOptions
Inherited Members
Extension Methods

Remarks

Allows configuring a default timeout and per-handler overrides based on the handler type name. This complements the existing TimeoutOptions which applies to message types.

Properties

DefaultTimeout

Gets or sets the default timeout applied to all handlers unless overridden.

public TimeSpan DefaultTimeout { get; set; }

Property Value

TimeSpan

The default timeout. Defaults to 30 seconds.

Enabled

Gets or sets a value indicating whether per-handler timeout is enabled.

public bool Enabled { get; set; }

Property Value

bool

true if enabled; otherwise, false. Defaults to true.

HandlerTimeouts

Gets per-handler timeout overrides keyed by handler type name.

public Dictionary<string, TimeSpan> HandlerTimeouts { get; init; }

Property Value

Dictionary<string, TimeSpan>

Dictionary mapping handler type names to timeout durations.

Examples

options.HandlerTimeouts["SlowImportHandler"] = TimeSpan.FromMinutes(5);
options.HandlerTimeouts["QuickPingHandler"] = TimeSpan.FromSeconds(2);

ThrowOnTimeout

Gets or sets a value indicating whether to throw on timeout. If false, returns a failed result instead.

public bool ThrowOnTimeout { get; set; }

Property Value

bool

true to throw; false to return a failed result. Defaults to true.