Class TimeoutMiddleware
- Namespace
- Excalibur.Dispatch.Middleware.Timeout
- Assembly
- Excalibur.Dispatch.dll
Middleware that implements timeout handling for message processing operations. Ensures operations complete within specified time limits and provides proper timeout handling.
[AppliesTo(MessageKinds.Action|MessageKinds.Event)]
public sealed class TimeoutMiddleware : IDispatchMiddleware
- Inheritance
-
TimeoutMiddleware
- Implements
- Inherited Members
- Extension Methods
Remarks
Initializes a new instance of the TimeoutMiddleware class.
Constructors
TimeoutMiddleware(ILogger<TimeoutMiddleware>, IOptions<TimeoutOptions>)
Middleware that implements timeout handling for message processing operations. Ensures operations complete within specified time limits and provides proper timeout handling.
public TimeoutMiddleware(ILogger<TimeoutMiddleware> logger, IOptions<TimeoutOptions> options)
Parameters
loggerILogger<TimeoutMiddleware>The logger for diagnostic output.
optionsIOptions<TimeoutOptions>The timeout configuration options.
Remarks
Initializes a new instance of the TimeoutMiddleware class.
Properties
ApplicableMessageKinds
Gets the message kinds this middleware applies to.
public MessageKinds ApplicableMessageKinds { get; }
Property Value
- MessageKinds
The current ApplicableMessageKinds value.
Stage
Gets the stage in the dispatch pipeline where this middleware executes.
public DispatchMiddlewareStage? Stage { get; }
Property Value
- DispatchMiddlewareStage?
The current Stage value.
Methods
InvokeAsync(IDispatchMessage, IMessageContext, DispatchRequestDelegate, CancellationToken)
Invokes the middleware to apply timeout handling to message processing.
public ValueTask<IMessageResult> InvokeAsync(IDispatchMessage message, IMessageContext context, DispatchRequestDelegate nextDelegate, CancellationToken cancellationToken)
Parameters
messageIDispatchMessageThe message being processed.
contextIMessageContextThe message context.
nextDelegateDispatchRequestDelegateThe next middleware in the pipeline.
cancellationTokenCancellationTokenCancellation token for the operation.
Returns
- ValueTask<IMessageResult>
A task representing the asynchronous operation.