public class KafkaSourceConsumerFn<T> extends DoFn<java.util.Map<java.lang.String,java.lang.String>,T>
Currently it has a time limiter (see 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)Or with a time limiter:
KafkaSourceConsumerFn(connectorClass, SourceRecordMapper, minutesToRun)
Modifier and Type | Class and Description |
---|---|
static class |
KafkaSourceConsumerFn.DebeziumSDFDatabaseHistory |
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
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BEAM_INSTANCE_PROPERTY |
Constructor and Description |
---|
KafkaSourceConsumerFn(java.lang.Class<?> connectorClass,
SourceRecordMapper<T> fn,
java.lang.Integer maxRecords)
Initializes the SDF to be run indefinitely.
|
KafkaSourceConsumerFn(java.lang.Class<?> connectorClass,
SourceRecordMapper<T> fn,
long minutesToRun)
Initializes the SDF with a time limit.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getHashCode() |
org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder |
getInitialRestriction(java.util.Map<java.lang.String,java.lang.String> unused) |
Coder<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder> |
getRestrictionCoder() |
RestrictionTracker<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder,java.util.Map<java.lang.String,java.lang.Object>> |
newTracker(org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder restriction) |
DoFn.ProcessContinuation |
process(java.util.Map<java.lang.String,java.lang.String> element,
RestrictionTracker<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder,java.util.Map<java.lang.String,java.lang.Object>> tracker,
DoFn.OutputReceiver<T> receiver)
Process the retrieved element.
|
getAllowedTimestampSkew, getInputTypeDescriptor, getOutputTypeDescriptor, populateDisplayData, prepareForProcessing
public static final java.lang.String BEAM_INSTANCE_PROPERTY
public KafkaSourceConsumerFn(java.lang.Class<?> connectorClass, SourceRecordMapper<T> fn, long minutesToRun)
connectorClass
- Supported Debezium connector classfn
- a SourceRecordMapperminutesToRun
- Maximum time to run (in minutes)public KafkaSourceConsumerFn(java.lang.Class<?> connectorClass, SourceRecordMapper<T> fn, java.lang.Integer maxRecords)
connectorClass
- Supported Debezium connector classfn
- a SourceRecordMapper@DoFn.GetInitialRestriction public org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder getInitialRestriction(@DoFn.Element java.util.Map<java.lang.String,java.lang.String> unused) throws java.io.IOException
java.io.IOException
@DoFn.NewTracker public RestrictionTracker<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder,java.util.Map<java.lang.String,java.lang.Object>> newTracker(@DoFn.Restriction org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder restriction)
@DoFn.GetRestrictionCoder public Coder<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder> getRestrictionCoder()
@DoFn.ProcessElement public DoFn.ProcessContinuation process(@DoFn.Element java.util.Map<java.lang.String,java.lang.String> element, RestrictionTracker<org.apache.beam.io.debezium.KafkaSourceConsumerFn.OffsetHolder,java.util.Map<java.lang.String,java.lang.Object>> tracker, DoFn.OutputReceiver<T> receiver) throws java.lang.Exception
element
- Record retrievedtracker
- Restriction Trackerreceiver
- Output Receiverjava.lang.Exception
public java.lang.String getHashCode()