Table of Contents

Interface IPoisonMessageHandler

Namespace
Excalibur.Dispatch.ErrorHandling
Assembly
Excalibur.Dispatch.dll

Defines the contract for handling poison messages that cannot be processed successfully.

public interface IPoisonMessageHandler
Extension Methods

Methods

GetStatisticsAsync(CancellationToken)

Gets statistics about poison messages.

Task<PoisonMessageStatistics> GetStatisticsAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task<PoisonMessageStatistics>

A task containing poison message statistics.

HandlePoisonMessageAsync(IDispatchMessage, IMessageContext, string, CancellationToken, Exception?)

Handles a poison message by moving it to the dead letter queue.

[RequiresUnreferencedCode("Poison message handling serializes message payloads and metadata which may require preserved members.")]
[RequiresDynamicCode("Uses dynamic code generation which requires JIT compilation.")]
Task HandlePoisonMessageAsync(IDispatchMessage message, IMessageContext context, string reason, CancellationToken cancellationToken, Exception? exception = null)

Parameters

message IDispatchMessage

The poison message to handle.

context IMessageContext

The message context containing metadata.

reason string

The reason why the message is considered poison.

cancellationToken CancellationToken

The cancellation token.

exception Exception

The exception that caused the message to be considered poison, if any.

Returns

Task

A task representing the asynchronous operation.

ReplayMessageAsync(string, CancellationToken)

Attempts to replay a message from the dead letter queue.

[RequiresUnreferencedCode("Dead letter message replay uses reflection to resolve message types from AssemblyQualifiedName strings for dynamic deserialization.")]
[RequiresDynamicCode("Uses dynamic code generation which requires JIT compilation.")]
Task<bool> ReplayMessageAsync(string messageId, CancellationToken cancellationToken)

Parameters

messageId string

The ID of the message to replay.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<bool>

A task representing the asynchronous operation with a boolean indicating success.