Class SequencerConsumerBehaviorBase
- Namespace
- Silverback.Messaging.Sequences
- Assembly
- Silverback.Integration.dll
Uses the available implementations of ISequenceReader to assign the incoming message to the right sequence.
public abstract class SequencerConsumerBehaviorBase : IConsumerBehavior, IBrokerBehavior, ISorted
- Inheritance
-
SequencerConsumerBehaviorBase
- Implements
- Derived
- Inherited Members
Remarks
A sequence is a set of messages that are handled as a single unit of work. A sequence could be used to group all chunks belonging to the same source message, all messages belonging to the same data set or to implement batch processing.
Constructors
SequencerConsumerBehaviorBase(IEnumerable<ISequenceReader>, ISilverbackLogger<SequencerConsumerBehaviorBase>)
Initializes a new instance of the SequencerConsumerBehaviorBase class.
protected SequencerConsumerBehaviorBase(IEnumerable<ISequenceReader> sequenceReaders, ISilverbackLogger<SequencerConsumerBehaviorBase> logger)
Parameters
sequenceReadersIEnumerable<ISequenceReader>The ISequenceReader implementations to be used.
loggerISilverbackLogger<SequencerConsumerBehaviorBase>The ISilverbackLogger.
Properties
SortIndex
Gets the sort index.
public abstract int SortIndex { get; }
Property Value
Methods
AwaitOtherBehaviorIfNeededAsync(ISequence)
When overridden in a derived class awaits for the sequence to be processed by the other twin behavior. This is used to have the RawSequencerConsumerBehavior wait for the processing by the SequencerConsumerBehavior and it's needed to be able to properly determine the sequence end in the case where a ChunkSequence is added into another sequence (e.g. BatchSequence).
protected virtual ValueTask AwaitOtherBehaviorIfNeededAsync(ISequence sequence)
Parameters
sequenceISequenceThe current sequence.
Returns
HandleAsync(ConsumerPipelineContext, ConsumerBehaviorHandler, CancellationToken)
Process, handles or transforms the message being consumed.
public virtual ValueTask HandleAsync(ConsumerPipelineContext context, ConsumerBehaviorHandler next, CancellationToken cancellationToken)
Parameters
contextConsumerPipelineContextThe context that is passed along the behaviors pipeline.
nextConsumerBehaviorHandlerThe next behavior in the pipeline.
cancellationTokenCancellationTokenThe cancellation token that can be used to cancel the operation.
Returns
PublishSequenceAsync(ConsumerPipelineContext, ConsumerBehaviorHandler, CancellationToken)
Forwards the new sequence to the next behavior in the pipeline.
protected abstract ValueTask PublishSequenceAsync(ConsumerPipelineContext context, ConsumerBehaviorHandler next, CancellationToken cancellationToken)
Parameters
contextConsumerPipelineContextThe context that is passed along the behaviors pipeline.
nextConsumerBehaviorHandlerThe next behavior in the pipeline.
cancellationTokenCancellationTokenThe cancellation token that can be used to cancel the operation.