@Internal public class ReadChangeStreamPartitionAction extends java.lang.Object
ReadChangeStreamPartitionDoFn
SDF.Constructor and Description |
---|
ReadChangeStreamPartitionAction(MetadataTableDao metadataTableDao,
ChangeStreamDao changeStreamDao,
ChangeStreamMetrics metrics,
ChangeStreamAction changeStreamAction,
Duration heartbeatDuration,
SizeEstimator<KV<com.google.protobuf.ByteString,com.google.cloud.bigtable.data.v2.models.ChangeStreamRecord>> sizeEstimator) |
Modifier and Type | Method and Description |
---|---|
DoFn.ProcessContinuation |
run(PartitionRecord partitionRecord,
RestrictionTracker<StreamProgress,StreamProgress> tracker,
DoFn.OutputReceiver<KV<com.google.protobuf.ByteString,com.google.cloud.bigtable.data.v2.models.ChangeStreamRecord>> receiver,
ManualWatermarkEstimator<Instant> watermarkEstimator)
Streams changes from a specific partition.
|
public ReadChangeStreamPartitionAction(MetadataTableDao metadataTableDao, ChangeStreamDao changeStreamDao, ChangeStreamMetrics metrics, ChangeStreamAction changeStreamAction, Duration heartbeatDuration, SizeEstimator<KV<com.google.protobuf.ByteString,com.google.cloud.bigtable.data.v2.models.ChangeStreamRecord>> sizeEstimator)
public DoFn.ProcessContinuation run(PartitionRecord partitionRecord, RestrictionTracker<StreamProgress,StreamProgress> tracker, DoFn.OutputReceiver<KV<com.google.protobuf.ByteString,com.google.cloud.bigtable.data.v2.models.ChangeStreamRecord>> receiver, ManualWatermarkEstimator<Instant> watermarkEstimator) throws java.io.IOException
ChangeStreamAction
to process
individual response from the change stream.
Before we send a request to Cloud Bigtable to stream the partition, we need to perform a few things.
DetectNewPartitionsDoFn
aggregates the watermark from all the streams to ensure
all the streams have reached beyond endTime so it can also terminate and end the
beam job.
DetectNewPartitionsDoFn
can read and output those new partitions to be streamed.
We also need to ensure we clean up this partition's metadata to release the lock.
partitionRecord
- partition information used to identify this streamtracker
- restriction tracker of ReadChangeStreamPartitionDoFn
receiver
- output receiver for ReadChangeStreamPartitionDoFn
watermarkEstimator
- watermark estimator ReadChangeStreamPartitionDoFn
DoFn.ProcessContinuation.stop()
if a checkpoint is required or the stream has
completed. Or DoFn.ProcessContinuation.resume()
if a checkpoint is required.java.io.IOException
- when stream fails.