Table of Contents

Interface IDocumentHandler<TDocument>

Namespace
Excalibur.Dispatch.Delivery
Assembly
Excalibur.Dispatch.Abstractions.dll

Defines a handler for processing document-style messages.

public interface IDocumentHandler<in TDocument> where TDocument : IDispatchDocument

Type Parameters

TDocument

The type of document to handle.

Extension Methods

Remarks

Implement this interface to process structured documents that flow through the messaging pipeline. Documents typically represent complete business entities or data transfer objects. Common use cases include:

  • Processing batch imports or exports
  • Handling complex data transformations
  • Processing reports, invoices, or other business documents
  • ETL (Extract, Transform, Load) operations
  • Handling file uploads or data synchronization

Multiple document handlers can process the same document type for different aspects (validation, transformation, storage, notification, etc.). The contravariant in modifier allows handlers to process base document types.

Methods

HandleAsync(TDocument, CancellationToken)

Handles the specified document asynchronously.

Task HandleAsync(TDocument document, CancellationToken cancellationToken)

Parameters

document TDocument

The document to process.

cancellationToken CancellationToken

The cancellation token to observe.

Returns

Task

A task representing the asynchronous operation.

Remarks

Implementations should handle large documents efficiently, potentially using streaming or chunking for memory optimization. Consider implementing progress reporting for long-running document processing operations.