Class DataChangeRecordAction
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.spanner.changestreams.action.DataChangeRecordAction
-
public class DataChangeRecordAction extends java.lang.ObjectThis class is part of the process forReadChangeStreamPartitionDoFnSDF. It is responsible for processingDataChangeRecords. The records will simply be emitted to the received output receiver.
-
-
Constructor Summary
Constructors Constructor Description DataChangeRecordAction(ThroughputEstimator<DataChangeRecord> throughputEstimator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<org.apache.beam.sdk.transforms.DoFn.ProcessContinuation>run(PartitionMetadata partition, DataChangeRecord record, org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker<TimestampRange,com.google.cloud.Timestamp> tracker, RestrictionInterrupter<com.google.cloud.Timestamp> interrupter, org.apache.beam.sdk.transforms.DoFn.OutputReceiver<DataChangeRecord> outputReceiver, org.apache.beam.sdk.transforms.splittabledofn.ManualWatermarkEstimator<org.joda.time.Instant> watermarkEstimator)This is the main processing function for aDataChangeRecord.
-
-
-
Constructor Detail
-
DataChangeRecordAction
public DataChangeRecordAction(ThroughputEstimator<DataChangeRecord> throughputEstimator)
- Parameters:
throughputEstimator- an estimator to calculate local throughput of this action.
-
-
Method Detail
-
run
public java.util.Optional<org.apache.beam.sdk.transforms.DoFn.ProcessContinuation> run(PartitionMetadata partition, DataChangeRecord record, org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker<TimestampRange,com.google.cloud.Timestamp> tracker, RestrictionInterrupter<com.google.cloud.Timestamp> interrupter, org.apache.beam.sdk.transforms.DoFn.OutputReceiver<DataChangeRecord> outputReceiver, org.apache.beam.sdk.transforms.splittabledofn.ManualWatermarkEstimator<org.joda.time.Instant> watermarkEstimator)
This is the main processing function for aDataChangeRecord. It returns anOptionalofDoFn.ProcessContinuationto indicate if the calling function should stop or not. If theOptionalreturned is empty, it means that the calling function can continue with the processing. If anOptionalofDoFn.ProcessContinuation.stop()is returned, it means that this function was unable to claim the timestamp of theDataChangeRecord, so the caller should stop.When processing the
DataChangeRecordthe following procedure is applied:- We try to cliam the data change record commit timestamp. If it is not possible, we stop here and return.
- We emit the data change record through the
DoFn.OutputReceiver. - We update the watermark to the data change record commit timestamp.
- Parameters:
partition- the current partition being processedrecord- the change stream data record receivedtracker- the restriction tracker of theReadChangeStreamPartitionDoFnSDFinterrupter- the restriction interrupter suggesting early termination of the processingoutputReceiver- the output receiver of theReadChangeStreamPartitionDoFnSDFwatermarkEstimator- the watermark estimator of theReadChangeStreamPartitionDoFnSDF- Returns:
Optional.empty()if the caller can continue processing more records. A non emptyOptionalwithDoFn.ProcessContinuation.stop()if this function was unable to claim theDataChangeRecordtimestamp. A non emptyOptionalwithDoFn.ProcessContinuation.resume()if this function should commit what has already been processed and resume.
-
-