Package org.apache.beam.io.debezium
Class KafkaSourceConsumerFn<T>
java.lang.Object
org.apache.beam.sdk.transforms.DoFn<Map<String,String>,T>
org.apache.beam.io.debezium.KafkaSourceConsumerFn<T>
- All Implemented Interfaces:
Serializable,HasDisplayData
Quick Overview
This is a SplittableDoFn used to process records fetched from supported Debezium
Connectors.
Currently it has a time limiter (see KafkaSourceConsumerFn.OffsetTracker) which, if set, it will stop
automatically after the specified elapsed minutes. Otherwise, it will keep running until the user
explicitly interrupts it.
It might be initialized either as:
KafkaSourceConsumerFn(connectorClass, SourceRecordMapper, maxRecords, millisecondsToRun)Or with a time limiter:
KafkaSourceConsumerFn(connectorClass, SourceRecordMapper, minutesToRun)
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.beam.sdk.transforms.DoFn
DoFn.AlwaysFetched, DoFn.BoundedPerElement, DoFn.BundleFinalizer, DoFn.Element, DoFn.FieldAccess, DoFn.FinishBundle, DoFn.FinishBundleContext, DoFn.GetInitialRestriction, DoFn.GetInitialWatermarkEstimatorState, DoFn.GetRestrictionCoder, DoFn.GetSize, DoFn.GetWatermarkEstimatorStateCoder, DoFn.Key, DoFn.MultiOutputReceiver, DoFn.NewTracker, DoFn.NewWatermarkEstimator, DoFn.OnTimer, DoFn.OnTimerContext, DoFn.OnTimerFamily, DoFn.OnWindowExpiration, DoFn.OnWindowExpirationContext, DoFn.OutputReceiver<T>, DoFn.ProcessContext, DoFn.ProcessContinuation, DoFn.ProcessElement, DoFn.RequiresStableInput, DoFn.RequiresTimeSortedInput, DoFn.Restriction, DoFn.Setup, DoFn.SideInput, DoFn.SplitRestriction, DoFn.StartBundle, DoFn.StartBundleContext, DoFn.StateId, DoFn.Teardown, DoFn.TimerFamily, DoFn.TimerId, DoFn.Timestamp, DoFn.TruncateRestriction, DoFn.UnboundedPerElement, DoFn.WatermarkEstimatorState, DoFn.WindowedContext -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHoldergetInitialRestriction(Map<String, String> unused) getInitialWatermarkEstimatorState(Instant currentElementTimestamp) protected org.apache.kafka.connect.source.SourceRecordgetOneRecord(Map<String, String> configuration) Coder<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder> RestrictionTracker<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder, Map<String, Object>> newTracker(org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder restriction) newWatermarkEstimator(Instant watermarkEstimatorState) process(Map<String, String> element, RestrictionTracker<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder, Map<String, Object>> tracker, DoFn.OutputReceiver<T> receiver) Process the retrieved element and format it for output.Methods inherited from class org.apache.beam.sdk.transforms.DoFn
getAllowedTimestampSkew, getInputTypeDescriptor, getOutputTypeDescriptor, populateDisplayData, prepareForProcessing
-
Field Details
-
BEAM_INSTANCE_PROPERTY
- See Also:
-
-
Method Details
-
getInitialRestriction
@GetInitialRestriction public org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder getInitialRestriction(@Element Map<String, String> unused) throws IOException- Throws:
IOException
-
newTracker
@NewTracker public RestrictionTracker<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder,Map<String, newTrackerObject>> (@Restriction org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder restriction) -
getRestrictionCoder
@GetRestrictionCoder public Coder<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder> getRestrictionCoder() -
getOneRecord
-
getInitialWatermarkEstimatorState
@GetInitialWatermarkEstimatorState public Instant getInitialWatermarkEstimatorState(@Timestamp Instant currentElementTimestamp) -
newWatermarkEstimator
@NewWatermarkEstimator public WatermarkEstimator<Instant> newWatermarkEstimator(@WatermarkEstimatorState Instant watermarkEstimatorState) -
process
@ProcessElement public DoFn.ProcessContinuation process(@Element Map<String, String> element, RestrictionTracker<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder, throws ExceptionMap<String, Object>> tracker, DoFn.OutputReceiver<T> receiver) Process the retrieved element and format it for output. Update all pending- Parameters:
element- A descriptor for the configuration of theSourceConnectorandSourceTaskinstances.tracker- Restriction Trackerreceiver- Output Receiver- Returns:
DoFn.ProcessContinuationin most cases, to continue processing after 1 second. Otherwise, if we've reached a limit of elements, to stop processing.- Throws:
Exception
-
getHashCode
-