Class ActionFactory
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.spanner.changestreams.action.ActionFactory
-
- All Implemented Interfaces:
java.io.Serializable
public class ActionFactory extends java.lang.Object implements java.io.Serializable
Factory class for creating instances that will handle each type of record within a change stream query. The instances created are all singletons.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ActionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChildPartitionsRecordAction
childPartitionsRecordAction(PartitionMetadataDao partitionMetadataDao, ChangeStreamMetrics metrics)
Creates and returns a singleton instance of an action class capable of processChildPartitionsRecord
s.DataChangeRecordAction
dataChangeRecordAction(ThroughputEstimator<DataChangeRecord> throughputEstimator)
Creates and returns a singleton instance of an action class capable of processingDataChangeRecord
s.DetectNewPartitionsAction
detectNewPartitionsAction(PartitionMetadataDao partitionMetadataDao, PartitionMetadataMapper partitionMetadataMapper, ChangeStreamMetrics metrics, org.joda.time.Duration resumeDuration)
Creates and returns a single instance of an action class capable of detecting and scheduling new partitions to be queried.HeartbeatRecordAction
heartbeatRecordAction(ChangeStreamMetrics metrics)
Creates and returns a singleton instance of an action class capable of processingHeartbeatRecord
s.QueryChangeStreamAction
queryChangeStreamAction(ChangeStreamDao changeStreamDao, PartitionMetadataDao partitionMetadataDao, ChangeStreamRecordMapper changeStreamRecordMapper, PartitionMetadataMapper partitionMetadataMapper, DataChangeRecordAction dataChangeRecordAction, HeartbeatRecordAction heartbeatRecordAction, ChildPartitionsRecordAction childPartitionsRecordAction, ChangeStreamMetrics metrics)
Creates and returns a single instance of an action class capable of performing a change stream query for a given partition.
-
-
-
Method Detail
-
dataChangeRecordAction
public DataChangeRecordAction dataChangeRecordAction(ThroughputEstimator<DataChangeRecord> throughputEstimator)
Creates and returns a singleton instance of an action class capable of processingDataChangeRecord
s.This method is thread safe.
- Returns:
- singleton instance of the
DataChangeRecordAction
-
heartbeatRecordAction
public HeartbeatRecordAction heartbeatRecordAction(ChangeStreamMetrics metrics)
Creates and returns a singleton instance of an action class capable of processingHeartbeatRecord
s. This method is thread safe.- Parameters:
metrics
- metrics gathering class- Returns:
- singleton instance of the
HeartbeatRecordAction
-
childPartitionsRecordAction
public ChildPartitionsRecordAction childPartitionsRecordAction(PartitionMetadataDao partitionMetadataDao, ChangeStreamMetrics metrics)
Creates and returns a singleton instance of an action class capable of processChildPartitionsRecord
s. This method is thread safe.- Parameters:
partitionMetadataDao
- DAO class to access the Connector's metadata tablesmetrics
- metrics gathering class- Returns:
- singleton instance of the
ChildPartitionsRecordAction
-
queryChangeStreamAction
public QueryChangeStreamAction queryChangeStreamAction(ChangeStreamDao changeStreamDao, PartitionMetadataDao partitionMetadataDao, ChangeStreamRecordMapper changeStreamRecordMapper, PartitionMetadataMapper partitionMetadataMapper, DataChangeRecordAction dataChangeRecordAction, HeartbeatRecordAction heartbeatRecordAction, ChildPartitionsRecordAction childPartitionsRecordAction, ChangeStreamMetrics metrics)
Creates and returns a single instance of an action class capable of performing a change stream query for a given partition. It uses theDataChangeRecordAction
,HeartbeatRecordAction
andChildPartitionsRecordAction
to dispatch the necessary processing depending on the type of record received.- Parameters:
changeStreamDao
- DAO class to perform a change stream querypartitionMetadataDao
- DAO class to access the Connector's metadata tableschangeStreamRecordMapper
- mapper class to transform change stream records into the Connector's domain modelspartitionMetadataMapper
- mapper class to transform partition metadata rows into the Connector's domain modelsdataChangeRecordAction
- action class to processDataChangeRecord
sheartbeatRecordAction
- action class to processHeartbeatRecord
schildPartitionsRecordAction
- action class to processChildPartitionsRecord
smetrics
- metrics gathering class- Returns:
- single instance of the
QueryChangeStreamAction
-
detectNewPartitionsAction
public DetectNewPartitionsAction detectNewPartitionsAction(PartitionMetadataDao partitionMetadataDao, PartitionMetadataMapper partitionMetadataMapper, ChangeStreamMetrics metrics, org.joda.time.Duration resumeDuration)
Creates and returns a single instance of an action class capable of detecting and scheduling new partitions to be queried.- Parameters:
partitionMetadataDao
- DAO class to access the Connector's metadata tablespartitionMetadataMapper
- mapper class to transform partition metadata table rows into the Connector's domain modelsmetrics
- metrics gathering classresumeDuration
- specifies the periodic schedule to re-execute the action- Returns:
- single instance of the
DetectNewPartitionsAction
-
-