Table of Contents

Class ChunkSequence

Namespace
Silverback.Messaging.Sequences.Chunking
Assembly
Silverback.Integration.dll

A sequence of chunks that belong to the same message.

public class ChunkSequence : RawSequence, ISequence, IDisposable
Inheritance
ChunkSequence
Implements
Inherited Members

Constructors

ChunkSequence(string, int?, ConsumerPipelineContext)

Initializes a new instance of the ChunkSequence class.

public ChunkSequence(string sequenceId, int? totalLength, ConsumerPipelineContext context)

Parameters

sequenceId string

The identifier that is used to match the consumed messages with their belonging sequence.

totalLength int?

The expected total length of the sequence.

context ConsumerPipelineContext

The current ConsumerPipelineContext, assuming that it will be the one from which the sequence gets published via the message bus.

Methods

AddCoreAsync(IRawInboundEnvelope, ISequence?, bool)

Adds the message to the sequence.

protected override Task<AddToSequenceResult> AddCoreAsync(IRawInboundEnvelope envelope, ISequence? sequence, bool throwIfUnhandled)

Parameters

envelope IRawInboundEnvelope

The envelope to be added to the sequence.

sequence ISequence

The sequence to be added to the sequence.

throwIfUnhandled bool

A boolean value indicating whether an exception must be thrown if no subscriber is handling the message.

Returns

Task<AddToSequenceResult>

A Task<TResult> representing the asynchronous operation. The task result contains a flag indicating whether the operation was successful and the number of streams that have been actually pushed.

IsLastMessage(IRawInboundEnvelope)

Implements the logic to recognize the last message in the sequence without relying on the TotalCount property.

protected override bool IsLastMessage(IRawInboundEnvelope envelope)

Parameters

envelope IRawInboundEnvelope

The envelope to be added to the sequence.

Returns

bool

true if it is the last message, otherwise false.