Class KafkaPipelineSource<T, TRecordKey, TRecordValue>
Consumes records from Kafka and publishes them into a Pipelinez pipeline.
public class KafkaPipelineSource<T, TRecordKey, TRecordValue> : PipelineSourceBase<T>, IPipelineExecutionConfigurable, IDistributedPipelineSource<T>, IPipelineSource<T>, IFlowSource<PipelineContainer<T>> where T : PipelineRecord where TRecordKey : class where TRecordValue : class
Type Parameters
TThe pipeline record type.
TRecordKeyThe Kafka key type.
TRecordValueThe Kafka value type.
- Inheritance
-
KafkaPipelineSource<T, TRecordKey, TRecordValue>
- Implements
- Inherited Members
Constructors
KafkaPipelineSource(string, KafkaSourceOptions, Func<TRecordKey, TRecordValue, T>)
Initializes a new Kafka-backed pipeline source.
public KafkaPipelineSource(string pipelineName, KafkaSourceOptions options, Func<TRecordKey, TRecordValue, T> recordMapper)
Parameters
pipelineNamestringThe owning pipeline name.
optionsKafkaSourceOptionsThe Kafka source configuration.
recordMapperFunc<TRecordKey, TRecordValue, T>Maps Kafka key and value payloads into pipeline records.
Properties
SupportsDistributedExecution
Gets a value indicating whether the source supports distributed execution.
public bool SupportsDistributedExecution { get; }
Property Value
TransportName
Gets the transport name reported in distributed metadata.
public string TransportName { get; }
Property Value
Methods
GetOwnedPartitions()
Gets the partitions currently owned by the source.
public IReadOnlyList<PipelinePartitionLease> GetOwnedPartitions()
Returns
- IReadOnlyList<PipelinePartitionLease>
The owned partition leases.
GetPartitionExecutionStates()
Gets the current execution state for owned partitions.
public IReadOnlyList<PipelinePartitionExecutionState> GetPartitionExecutionStates()
Returns
- IReadOnlyList<PipelinePartitionExecutionState>
The partition execution state snapshots.
Initialize()
Provides an opportunity for the source to initialize transport-specific state.
protected override void Initialize()
MainLoop(CancellationTokenSource)
Executes the main source loop.
protected override 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 override void OnPipelineContainerComplete(object sender, PipelineContainerCompletedEventHandlerArgs<PipelineContainer<T>> e)
Parameters
senderobjectThe event sender.
ePipelineContainerCompletedEventHandlerArgs<PipelineContainer<T>>The completed container event arguments.