Class ConsumerPipelineContext
The context that is passed along the consumer behaviors pipeline.
Implements
Inherited Members
Namespace: Silverback.Messaging.Broker.Behaviors
Assembly: Silverback.Integration.dll
Syntax
public sealed class ConsumerPipelineContext : IDisposable
Constructors
ConsumerPipelineContext(IRawInboundEnvelope, IConsumer, ISequenceStore, IReadOnlyList<IConsumerBehavior>, IServiceProvider)
Initializes a new instance of the ConsumerPipelineContext class.
Declaration
public ConsumerPipelineContext(IRawInboundEnvelope envelope, IConsumer consumer, ISequenceStore sequenceStore, IReadOnlyList<IConsumerBehavior> pipeline, IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IRawInboundEnvelope | envelope | The envelope containing the message being processed. |
| IConsumer | consumer | The IConsumer that triggered this pipeline. |
| ISequenceStore | sequenceStore | The ISequenceStore used to temporary store the pending sequences being consumed. |
| IReadOnlyList<IConsumerBehavior> | pipeline | The behaviors composing the pipeline. |
| IServiceProvider | serviceProvider | The IServiceProvider to be used to resolve the required services. |
Properties
Consumer
Gets the IConsumer that triggered this pipeline.
Declaration
public IConsumer Consumer { get; }
Property Value
| Type | Description |
|---|---|
| IConsumer |
CurrentStepIndex
Gets the index of the current step in the pipeline.
Declaration
public int CurrentStepIndex { get; }
Property Value
| Type | Description |
|---|---|
| int |
Envelope
Gets or sets the envelopes containing the messages being processed.
Declaration
public IRawInboundEnvelope Envelope { get; set; }
Property Value
| Type | Description |
|---|---|
| IRawInboundEnvelope |
IsSequenceEnd
Gets a value indicating whether the current message was recognized as the end of the sequence.
Declaration
public bool IsSequenceEnd { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsSequenceStart
Gets a value indicating whether the current message was recognized as the beginning of a new sequence.
Declaration
public bool IsSequenceStart { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Pipeline
Gets the behaviors composing the pipeline.
Declaration
public IReadOnlyList<IConsumerBehavior> Pipeline { get; }
Property Value
| Type | Description |
|---|---|
| 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.
Declaration
public Task? ProcessingTask { get; }
Property Value
| Type | Description |
|---|---|
| Task |
Sequence
Gets the ISequence that the current message belongs to.
Declaration
public ISequence? Sequence { get; }
Property Value
| Type | Description |
|---|---|
| ISequence |
SequenceStore
Gets the ISequenceStore used to temporary store the pending sequences being consumed.
Declaration
public ISequenceStore SequenceStore { get; }
Property Value
| Type | Description |
|---|---|
| ISequenceStore |
ServiceProvider
Gets the IServiceProvider to be used to resolve the necessary services.
Declaration
public IServiceProvider ServiceProvider { get; }
Property Value
| Type | Description |
|---|---|
| IServiceProvider |
SilverbackContext
Gets the ISilverbackContext.
Declaration
public ISilverbackContext SilverbackContext { get; }
Property Value
| Type | Description |
|---|---|
| ISilverbackContext |
TransactionManager
Gets the IConsumerTransactionManager that is handling the current pipeline transaction.
Declaration
public IConsumerTransactionManager TransactionManager { get; }
Property Value
| Type | Description |
|---|---|
| IConsumerTransactionManager |
Methods
Clone(IRawInboundEnvelope?)
Clones the current context, optionally replacing the envelope.
Declaration
public ConsumerPipelineContext Clone(IRawInboundEnvelope? newEnvelope = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IRawInboundEnvelope | newEnvelope | The new envelope to be used in the cloned context. |
Returns
| Type | Description |
|---|---|
| ConsumerPipelineContext | The cloned context. |
Dispose()
The context that is passed along the consumer behaviors pipeline.
Declaration
public void Dispose()
GetCommitIdentifiers()
Gets the identifiers to be used to commit after successful processing.
Declaration
public IReadOnlyCollection<IBrokerMessageIdentifier> GetCommitIdentifiers()
Returns
| Type | Description |
|---|---|
| IReadOnlyCollection<IBrokerMessageIdentifier> | The identifiers to be used to commit. |
GetRollbackIdentifiers()
Gets the identifiers to be used to roll back in case of error.
Declaration
public IReadOnlyCollection<IBrokerMessageIdentifier> GetRollbackIdentifiers()
Returns
| Type | Description |
|---|---|
| IReadOnlyCollection<IBrokerMessageIdentifier> | The identifiers to be used to roll back. |
ReplaceServiceScope(IServiceScope)
Replaces the IServiceProvider with the one from the specified scope.
Declaration
public void ReplaceServiceScope(IServiceScope newServiceScope)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceScope | newServiceScope | 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.
Declaration
public void SetIsSequenceEnd()
SetSequence(ISequence, in bool)
Sets the current sequence.
Declaration
public void SetSequence(ISequence sequence, in bool isSequenceStart)
Parameters
| Type | Name | Description |
|---|---|---|
| ISequence | sequence | The ISequence being processed. |
| bool | isSequenceStart | A value indicating whether the current message was recognized as the beginning of a new sequence. |