Table of Contents

Class ConsumerPipelineContext

Namespace
Silverback.Messaging.Broker.Behaviors
Assembly
Silverback.Integration.dll

The context that is passed along the consumer behaviors pipeline.

public sealed class ConsumerPipelineContext : IDisposable
Inheritance
ConsumerPipelineContext
Implements
Inherited Members

Constructors

ConsumerPipelineContext(IRawInboundEnvelope, IConsumer, ISequenceStore, IReadOnlyList<IConsumerBehavior>, IServiceProvider)

Initializes a new instance of the ConsumerPipelineContext class.

public ConsumerPipelineContext(IRawInboundEnvelope envelope, IConsumer consumer, ISequenceStore sequenceStore, IReadOnlyList<IConsumerBehavior> pipeline, IServiceProvider serviceProvider)

Parameters

envelope IRawInboundEnvelope

The envelope containing the message being processed.

consumer IConsumer

The IConsumer that triggered this pipeline.

sequenceStore ISequenceStore

The ISequenceStore used to temporary store the pending sequences being consumed.

pipeline IReadOnlyList<IConsumerBehavior>

The behaviors composing the pipeline.

serviceProvider IServiceProvider

The IServiceProvider to be used to resolve the required services.

Properties

Consumer

Gets the IConsumer that triggered this pipeline.

public IConsumer Consumer { get; }

Property Value

IConsumer

CurrentStepIndex

Gets the index of the current step in the pipeline.

public int CurrentStepIndex { get; }

Property Value

int

Envelope

Gets or sets the envelopes containing the messages being processed.

public IRawInboundEnvelope Envelope { get; set; }

Property Value

IRawInboundEnvelope

IsSequenceEnd

Gets a value indicating whether the current message was recognized as the end of the sequence.

public bool IsSequenceEnd { get; }

Property Value

bool

IsSequenceStart

Gets a value indicating whether the current message was recognized as the beginning of a new sequence.

public bool IsSequenceStart { get; }

Property Value

bool

Pipeline

Gets the behaviors composing the pipeline.

public IReadOnlyList<IConsumerBehavior> Pipeline { get; }

Property Value

IReadOnlyList<IConsumerBehavior>

ProcessingTask

Gets the Task representing the message processing when it is not directly awaited (e.g., when starting the processing of a Sequence. This Task will complete when all subscribers return.

public Task? ProcessingTask { get; }

Property Value

Task

Sequence

Gets the ISequence that the current message belongs to.

public ISequence? Sequence { get; }

Property Value

ISequence

SequenceStore

Gets the ISequenceStore used to temporary store the pending sequences being consumed.

public ISequenceStore SequenceStore { get; }

Property Value

ISequenceStore

ServiceProvider

Gets the IServiceProvider to be used to resolve the necessary services.

public IServiceProvider ServiceProvider { get; }

Property Value

IServiceProvider

SilverbackContext

public ISilverbackContext SilverbackContext { get; }

Property Value

ISilverbackContext

TransactionManager

Gets the IConsumerTransactionManager that is handling the current pipeline transaction.

public IConsumerTransactionManager TransactionManager { get; }

Property Value

IConsumerTransactionManager

Methods

Clone(IRawInboundEnvelope?)

Clones the current context, optionally replacing the envelope.

public ConsumerPipelineContext Clone(IRawInboundEnvelope? newEnvelope = null)

Parameters

newEnvelope IRawInboundEnvelope

The new envelope to be used in the cloned context.

Returns

ConsumerPipelineContext

The cloned context.

Dispose()

public void Dispose()

GetCommitIdentifiers()

Gets the identifiers to be used to commit after successful processing.

public IReadOnlyCollection<IBrokerMessageIdentifier> GetCommitIdentifiers()

Returns

IReadOnlyCollection<IBrokerMessageIdentifier>

The identifiers to be used to commit.

GetRollbackIdentifiers()

Gets the identifiers to be used to roll back in case of error.

public IReadOnlyCollection<IBrokerMessageIdentifier> GetRollbackIdentifiers()

Returns

IReadOnlyCollection<IBrokerMessageIdentifier>

The identifiers to be used to roll back.

ReplaceServiceScope(IServiceScope)

Replaces the IServiceProvider with the one from the specified scope.

public void ReplaceServiceScope(IServiceScope newServiceScope)

Parameters

newServiceScope IServiceScope

The IServiceScope to be used.

SetIsSequenceEnd()

Sets the IsSequenceEnd property to true, indicating that the current message was recognized as the end of the sequence.

public void SetIsSequenceEnd()

SetSequence(ISequence, in bool)

Sets the current sequence.

public void SetSequence(ISequence sequence, in bool isSequenceStart)

Parameters

sequence ISequence

The ISequence being processed.

isSequenceStart bool

A value indicating whether the current message was recognized as the beginning of a new sequence.