Class SequencerConsumerBehavior
- Namespace
- Silverback.Messaging.Sequences
- Assembly
- Silverback.Integration.dll
Uses the available implementations of ISequenceReader to assign the incoming message to the right sequence.
public class SequencerConsumerBehavior : SequencerConsumerBehaviorBase, IConsumerBehavior, IBrokerBehavior, ISorted
- Inheritance
-
SequencerConsumerBehavior
- Implements
- 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
SequencerConsumerBehavior(IEnumerable<ISequenceReader>, ISilverbackLogger<SequencerConsumerBehavior>)
Initializes a new instance of the SequencerConsumerBehavior class.
public SequencerConsumerBehavior(IEnumerable<ISequenceReader> sequenceReaders, ISilverbackLogger<SequencerConsumerBehavior> logger)
Parameters
sequenceReadersIEnumerable<ISequenceReader>The ISequenceReader implementations to be used.
loggerISilverbackLogger<SequencerConsumerBehavior>The ISilverbackLogger.
Properties
SortIndex
Gets the sort index.
public override int SortIndex { get; }
Property Value
Methods
HandleAsync(ConsumerPipelineContext, ConsumerBehaviorHandler, CancellationToken)
Process, handles or transforms the message being consumed.
public override 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 override 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.