Class PipelineSourceBase<T>
Provides a base implementation for pipeline sources backed by a Dataflow buffer.
public abstract class PipelineSourceBase<T> : IPipelineSource<T>, IFlowSource<PipelineContainer<T>>, IPipelineExecutionConfigurable where T : PipelineRecord
Type Parameters
TThe pipeline record type produced by the source.
- Inheritance
-
PipelineSourceBase<T>
- Implements
- Derived
- Inherited Members
Constructors
PipelineSourceBase()
Initializes a new source base instance.
public PipelineSourceBase()
Properties
Completion
Gets a task that completes when the source has finished publishing records.
public Task Completion { get; }
Property Value
Logger
Gets the logger used by the source.
protected ILogger<PipelineSourceBase<T>> Logger { get; }
Property Value
ParentPipeline
Gets the parent pipeline.
protected Pipeline<T> ParentPipeline { get; }
Property Value
- Pipeline<T>
Methods
Complete()
Marks the source as complete so no additional records will be published.
public void Complete()
ConfigureExecutionOptions(PipelineExecutionOptions)
Applies execution options to the component before it begins processing.
public void ConfigureExecutionOptions(PipelineExecutionOptions options)
Parameters
optionsPipelineExecutionOptionsThe execution options to apply.
ConnectTo(IFlowDestination<PipelineContainer<T>>, DataflowLinkOptions?)
Connects the source to a downstream destination.
public IDisposable ConnectTo(IFlowDestination<PipelineContainer<T>> target, DataflowLinkOptions? options = null)
Parameters
targetIFlowDestination<PipelineContainer<T>>The destination that should receive published output.
optionsDataflowLinkOptionsOptional Dataflow link options applied to the connection.
Returns
- IDisposable
A disposable link handle that can be used to disconnect the source from the destination.
GetExecutionOptions()
Gets the execution options currently configured for the component.
public PipelineExecutionOptions GetExecutionOptions()
Returns
- PipelineExecutionOptions
The active execution options.
Initialize()
Provides an opportunity for the source to initialize transport-specific state.
protected abstract void Initialize()
Initialize(Pipeline<T>)
Initializes the source with its parent pipeline.
public void Initialize(Pipeline<T> parentPipeline)
Parameters
parentPipelinePipeline<T>The owning pipeline.
MainLoop(CancellationTokenSource)
Executes the main source loop.
protected abstract Task MainLoop(CancellationTokenSource cancellationToken)
Parameters
cancellationTokenCancellationTokenSourceThe runtime cancellation source used to stop the source.
Returns
- Task
A task that completes when the source loop exits.
OnPipelineContainerComplete(object, PipelineContainerCompletedEventHandlerArgs<PipelineContainer<T>>)
Handles notification that a published container completed successfully.
public virtual void OnPipelineContainerComplete(object sender, PipelineContainerCompletedEventHandlerArgs<PipelineContainer<T>> e)
Parameters
senderobjectThe event sender.
ePipelineContainerCompletedEventHandlerArgs<PipelineContainer<T>>The completed container event arguments.
PublishAsync(T)
Publishes a record using the pipeline's default flow-control behavior.
public Task PublishAsync(T record)
Parameters
recordTThe record to publish.
Returns
PublishAsync(T, PipelinePublishOptions)
Publishes a record using explicit publish options.
public Task<PipelinePublishResult> PublishAsync(T record, PipelinePublishOptions options)
Parameters
recordTThe record to publish.
optionsPipelinePublishOptionsThe publish options to apply.
Returns
- Task<PipelinePublishResult>
The publish result.
PublishAsync(T, MetadataCollection)
Publishes a record with explicit metadata using the pipeline's default flow-control behavior.
public Task PublishAsync(T record, MetadataCollection metadata)
Parameters
recordTThe record to publish.
metadataMetadataCollectionThe metadata to attach to the record.
Returns
PublishAsync(T, MetadataCollection, PipelinePublishOptions)
Publishes a record with explicit metadata and publish options.
public Task<PipelinePublishResult> PublishAsync(T record, MetadataCollection metadata, PipelinePublishOptions options)
Parameters
recordTThe record to publish.
metadataMetadataCollectionThe metadata to attach to the record.
optionsPipelinePublishOptionsThe publish options to apply.
Returns
- Task<PipelinePublishResult>
The publish result.
StartAsync(CancellationTokenSource)
Starts the source execution loop.
public Task StartAsync(CancellationTokenSource cancellationToken)
Parameters
cancellationTokenCancellationTokenSourceThe runtime cancellation source used to stop the source.