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
envelopeIRawInboundEnvelopeThe envelope containing the message being processed.
consumerIConsumerThe IConsumer that triggered this pipeline.
sequenceStoreISequenceStoreThe ISequenceStore used to temporary store the pending sequences being consumed.
pipelineIReadOnlyList<IConsumerBehavior>The behaviors composing the pipeline.
serviceProviderIServiceProviderThe IServiceProvider to be used to resolve the required services.
Properties
Consumer
Gets the IConsumer that triggered this pipeline.
public IConsumer Consumer { get; }
Property Value
CurrentStepIndex
Gets the index of the current step in the pipeline.
public int CurrentStepIndex { get; }
Property Value
Envelope
Gets or sets the envelopes containing the messages being processed.
public IRawInboundEnvelope Envelope { get; set; }
Property Value
IsSequenceEnd
Gets a value indicating whether the current message was recognized as the end of the sequence.
public bool IsSequenceEnd { get; }
Property Value
IsSequenceStart
Gets a value indicating whether the current message was recognized as the beginning of a new sequence.
public bool IsSequenceStart { get; }
Property Value
Pipeline
Gets the behaviors composing the pipeline.
public IReadOnlyList<IConsumerBehavior> Pipeline { get; }
Property Value
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
Sequence
Gets the ISequence that the current message belongs to.
public ISequence? Sequence { get; }
Property Value
SequenceStore
Gets the ISequenceStore used to temporary store the pending sequences being consumed.
public ISequenceStore SequenceStore { get; }
Property Value
ServiceProvider
Gets the IServiceProvider to be used to resolve the necessary services.
public IServiceProvider ServiceProvider { get; }
Property Value
SilverbackContext
Gets the ISilverbackContext.
public ISilverbackContext SilverbackContext { get; }
Property Value
TransactionManager
Gets the IConsumerTransactionManager that is handling the current pipeline transaction.
public IConsumerTransactionManager TransactionManager { get; }
Property Value
Methods
Clone(IRawInboundEnvelope?)
Clones the current context, optionally replacing the envelope.
public ConsumerPipelineContext Clone(IRawInboundEnvelope? newEnvelope = null)
Parameters
newEnvelopeIRawInboundEnvelopeThe 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
newServiceScopeIServiceScopeThe 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)