Class StreamingDocument
Abstract base record for document-style messages that support streaming scenarios.
public abstract record StreamingDocument : IDispatchDocument, IDispatchMessage, IEquatable<StreamingDocument>
- Inheritance
-
StreamingDocument
- Implements
- Inherited Members
- Extension Methods
Remarks
StreamingDocument provides a reference-type base for documents that may be streamed as part of an IAsyncEnumerable<T> sequence. Unlike Chunk<T> which wraps arbitrary data with positional metadata, this type represents documents that inherently participate in streaming workflows.
Use cases include:
- Batch import/export operations where each document represents a record
- Event replay scenarios with per-document metadata
- Pipeline processing where documents flow through multiple handlers
- Change data capture streams where each change is a document
Derived types should add domain-specific properties while inheriting the streaming metadata.
Constructors
StreamingDocument(string, long)
Abstract base record for document-style messages that support streaming scenarios.
protected StreamingDocument(string StreamId, long SequenceNumber)
Parameters
StreamIdstringA unique identifier for the stream this document belongs to. Used to correlate documents within the same logical sequence.
SequenceNumberlongThe zero-based position of this document within its stream. Combined with
StreamId, provides total ordering guarantees.
Remarks
StreamingDocument provides a reference-type base for documents that may be streamed as part of an IAsyncEnumerable<T> sequence. Unlike Chunk<T> which wraps arbitrary data with positional metadata, this type represents documents that inherently participate in streaming workflows.
Use cases include:
- Batch import/export operations where each document represents a record
- Event replay scenarios with per-document metadata
- Pipeline processing where documents flow through multiple handlers
- Change data capture streams where each change is a document
Derived types should add domain-specific properties while inheriting the streaming metadata.
Properties
CorrelationId
Gets the correlation identifier for tracing this document across services.
public string? CorrelationId { get; init; }
Property Value
IsEndOfStream
Gets a value indicating whether this document marks the end of the stream.
public bool IsEndOfStream { get; init; }
Property Value
Remarks
Handlers can use this property to perform finalization logic when the stream completes.
SequenceNumber
The zero-based position of this document within its stream. Combined with
StreamId, provides total ordering guarantees.
public long SequenceNumber { get; init; }
Property Value
StreamId
A unique identifier for the stream this document belongs to. Used to correlate documents within the same logical sequence.
public string StreamId { get; init; }
Property Value
Timestamp
Gets the timestamp when this document was created or received.
public DateTimeOffset Timestamp { get; init; }
Property Value
- DateTimeOffset
The UTC timestamp of document creation.