@DoFn.UnboundedPerElement public class DetectNewPartitionsDoFn extends DoFn<PartitionMetadata,PartitionMetadata>
PartitionMetadata.State.CREATED, update their state to PartitionMetadata.State.SCHEDULED and output them to the next
stage in the pipeline.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| Constructor and Description |
|---|
DetectNewPartitionsDoFn(DaoFactory daoFactory,
MapperFactory mapperFactory,
ActionFactory actionFactory,
ChangeStreamMetrics metrics)
This class needs a
DaoFactory to build DAOs to access the partition metadata tables. |
| Modifier and Type | Method and Description |
|---|---|
Instant |
getInitialWatermarkEstimatorState(PartitionMetadata partition) |
TimestampRange |
initialRestriction(PartitionMetadata partition)
Uses an
TimestampRange with a max range. |
ManualWatermarkEstimator<Instant> |
newWatermarkEstimator(Instant watermarkEstimatorState) |
DoFn.ProcessContinuation |
processElement(RestrictionTracker<TimestampRange,com.google.cloud.Timestamp> tracker,
DoFn.OutputReceiver<PartitionMetadata> receiver,
ManualWatermarkEstimator<Instant> watermarkEstimator)
Main processing function for the
DetectNewPartitionsDoFn function. |
DetectNewPartitionsRangeTracker |
restrictionTracker(TimestampRange restriction) |
void |
setup()
Obtains the instance of
DetectNewPartitionsAction. |
getAllowedTimestampSkew, getInputTypeDescriptor, getOutputTypeDescriptor, populateDisplayData, prepareForProcessingpublic DetectNewPartitionsDoFn(DaoFactory daoFactory, MapperFactory mapperFactory, ActionFactory actionFactory, ChangeStreamMetrics metrics)
DaoFactory to build DAOs to access the partition metadata tables. It
uses mappers to transform database rows into the PartitionMetadata model. It builds the
delegating action class using the ActionFactory. It emits metrics for the partitions
read using the ChangeStreamMetrics. It re-schedules the process element function to be
executed according to the default resume interval as in DEFAULT_RESUME_DURATION (best effort).daoFactory - the DaoFactory to construct PartitionMetadataDaosmapperFactory - the MapperFactory to construct PartitionMetadataMappersactionFactory - the ActionFactory to construct actionsmetrics - the ChangeStreamMetrics to emit partition related metrics@DoFn.GetInitialWatermarkEstimatorState public Instant getInitialWatermarkEstimatorState(@DoFn.Element PartitionMetadata partition)
@DoFn.NewWatermarkEstimator public ManualWatermarkEstimator<Instant> newWatermarkEstimator(@DoFn.WatermarkEstimatorState Instant watermarkEstimatorState)
@DoFn.GetInitialRestriction public TimestampRange initialRestriction(@DoFn.Element PartitionMetadata partition)
TimestampRange with a max range. This is because it does not know beforehand
how many partitions it will schedule.@DoFn.NewTracker public DetectNewPartitionsRangeTracker restrictionTracker(@DoFn.Restriction TimestampRange restriction)
@DoFn.Setup public void setup()
DetectNewPartitionsAction.@DoFn.ProcessElement public DoFn.ProcessContinuation processElement(RestrictionTracker<TimestampRange,com.google.cloud.Timestamp> tracker, DoFn.OutputReceiver<PartitionMetadata> receiver, ManualWatermarkEstimator<Instant> watermarkEstimator)
DetectNewPartitionsDoFn function. It will delegate to
the DetectNewPartitionsAction class.