Class HeartbeatRecordAction
java.lang.Object
org.apache.beam.sdk.io.gcp.spanner.changestreams.action.HeartbeatRecordAction
This class is part of the process for
ReadChangeStreamPartitionDoFn SDF. It is
responsible for processing HeartbeatRecords. The records will be used to progress the
watermark for the current element (partition).-
Method Summary
Modifier and TypeMethodDescriptionrun(PartitionMetadata partition, HeartbeatRecord record, RestrictionTracker<TimestampRange, com.google.cloud.Timestamp> tracker, RestrictionInterrupter<com.google.cloud.Timestamp> interrupter, ManualWatermarkEstimator<Instant> watermarkEstimator) This is the main processing function for aHeartbeatRecord.
-
Method Details
-
run
public Optional<DoFn.ProcessContinuation> run(PartitionMetadata partition, HeartbeatRecord record, RestrictionTracker<TimestampRange, com.google.cloud.Timestamp> tracker, RestrictionInterrupter<com.google.cloud.Timestamp> interrupter, ManualWatermarkEstimator<Instant> watermarkEstimator) This is the main processing function for aHeartbeatRecord. 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 theHeartbeatRecord, so the caller should stop. If anOptionalofDoFn.ProcessContinuation.resume()is returned, it means that this function should not attempt to claim further timestamps of theHeartbeatRecord, but instead should commit what it has processed so far.When processing the
HeartbeatRecordthe following procedure is applied:- We try to claim the heartbeat record timestamp. If it is not possible, we stop here and return.
- We update the necessary metrics.
- We update the watermark to the heartbeat record timestamp.
-