Table of Contents

Class SequenceReaderBase

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

The base class for the ISequenceReader implementations. It encapsulates the logic to deal with the ISequenceStore.

public abstract class SequenceReaderBase : ISequenceReader
Inheritance
SequenceReaderBase
Implements
Derived
Inherited Members

Constructors

SequenceReaderBase(bool)

Initializes a new instance of the SequenceReaderBase class.

protected SequenceReaderBase(bool handlesRawMessages = false)

Parameters

handlesRawMessages bool

A value indicating whether this reader handles the raw messages, before they are being deserialized, decrypted, etc.

Properties

HandlesRawMessages

Gets a value indicating whether this reader handles the raw messages, before they are being deserialized, decrypted, etc.

public bool HandlesRawMessages { get; }

Property Value

bool

Methods

CanHandleAsync(ConsumerPipelineContext)

Checks whether this reader can and must handle the message being processed in the specified context.

public abstract ValueTask<bool> CanHandleAsync(ConsumerPipelineContext context)

Parameters

context ConsumerPipelineContext

The current ConsumerPipelineContext.

Returns

ValueTask<bool>

A Task<TResult> representing the asynchronous operation. The task result contains a value indicating whether this reader can and must handle the message.

CreateNewSequenceAsync(string, ConsumerPipelineContext)

Creates the new sequence and adds it to the store.

protected virtual ValueTask<ISequence> CreateNewSequenceAsync(string sequenceId, ConsumerPipelineContext context)

Parameters

sequenceId string

The sequence identifier.

context ConsumerPipelineContext

The current ConsumerPipelineContext.

Returns

ValueTask<ISequence>

The new sequence.

CreateNewSequenceCore(string, ConsumerPipelineContext)

Creates the new sequence object.

protected abstract ISequence CreateNewSequenceCore(string sequenceId, ConsumerPipelineContext context)

Parameters

sequenceId string

The sequence identifier.

context ConsumerPipelineContext

The current ConsumerPipelineContext.

Returns

ISequence

The new sequence.

GetExistingSequenceAsync(ConsumerPipelineContext, string)

Retrieves the existing incomplete sequence from the store.

protected virtual ValueTask<ISequence?> GetExistingSequenceAsync(ConsumerPipelineContext context, string sequenceId)

Parameters

context ConsumerPipelineContext

The current ConsumerPipelineContext.

sequenceId string

The sequence identifier.

Returns

ValueTask<ISequence>

The ISequence or null if not found.

GetSequenceAsync(ConsumerPipelineContext)

Returns the ISequence related to the message being processed.

public ValueTask<ISequence> GetSequenceAsync(ConsumerPipelineContext context)

Parameters

context ConsumerPipelineContext

The current ConsumerPipelineContext.

Returns

ValueTask<ISequence>

A Task<TResult> representing the asynchronous operation. The task result contains the ISequence.

GetSequenceIdAsync(ConsumerPipelineContext)

Gets the sequence identifier extracted from the current envelope.

protected abstract ValueTask<string> GetSequenceIdAsync(ConsumerPipelineContext context)

Parameters

context ConsumerPipelineContext

The current ConsumerPipelineContext.

Returns

ValueTask<string>

A Task<TResult> representing the asynchronous operation. The task result contains the recognized sequence identifier, or null.

IsNewSequenceAsync(string, ConsumerPipelineContext)

Determines if the current message corresponds with the beginning of a new sequence.

protected abstract ValueTask<bool> IsNewSequenceAsync(string sequenceId, ConsumerPipelineContext context)

Parameters

sequenceId string

The sequence identifier.

context ConsumerPipelineContext

The current ConsumerPipelineContext.

Returns

ValueTask<bool>

A Task<TResult> representing the asynchronous operation. The task result contains true if a new sequence is starting; otherwise false.