Class MongoDBSource.Builder<T>
- java.lang.Object
-
- org.apache.flink.cdc.connectors.mongodb.MongoDBSource.Builder<T>
-
- Enclosing class:
- MongoDBSource
public static class MongoDBSource.Builder<T> extends Object
Builder class ofMongoDBSource.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MongoDBSource.Builder<T>batchSize(int batchSize)batch.sizeDebeziumSourceFunction<T>build()The properties of mongodb kafka connector.MongoDBSource.Builder<T>collectionList(String... collectionList)Regular expressions that match fully-qualified collection identifiers for collections to be monitored.MongoDBSource.Builder<T>connectionOptions(String connectionOptions)Ampersand (i.e.MongoDBSource.Builder<T>copyExisting(boolean copyExisting)Deprecated.please usestartupOptionsinstead.MongoDBSource.Builder<T>copyExistingMaxThreads(int copyExistingMaxThreads)Deprecated.useinitialSnapshottingMaxThreadsinstead.MongoDBSource.Builder<T>copyExistingPipeline(String copyExistingPipeline)Deprecated.useinitialSnapshottingPipelineinstead.MongoDBSource.Builder<T>copyExistingQueueSize(int copyExistingQueueSize)Deprecated.useinitialSnapshottingQueueSizeinstead.MongoDBSource.Builder<T>databaseList(String... databaseList)Regular expressions list that match database names to be monitored.MongoDBSource.Builder<T>deserializer(DebeziumDeserializationSchema<T> deserializer)The deserializer used to convert from consumedSourceRecord.MongoDBSource.Builder<T>heartbeatIntervalMillis(int heartbeatIntervalMillis)heartbeat.interval.msMongoDBSource.Builder<T>hosts(String hosts)The comma-separated list of hostname and port pairs of mongodb servers.MongoDBSource.Builder<T>initialSnapshottingMaxThreads(int initialSnapshottingMaxThreads)initial.snapshotting.max.threadsMongoDBSource.Builder<T>initialSnapshottingPipeline(String initialSnapshottingPipeline)initial.snapshotting.pipeline eg.MongoDBSource.Builder<T>initialSnapshottingQueueSize(int initialSnapshottingQueueSize)initial.snapshotting.queue.sizeMongoDBSource.Builder<T>password(String password)Password to be used when connecting to MongoDB.MongoDBSource.Builder<T>pollAwaitTimeMillis(int pollAwaitTimeMillis)poll.await.time.msMongoDBSource.Builder<T>pollMaxBatchSize(int pollMaxBatchSize)poll.max.batch.sizeMongoDBSource.Builder<T>scanFullChangelog(boolean fullDocumentBeforeChange)change.stream.full.document.before.changeMongoDBSource.Builder<T>scheme(String scheme)The protocol connected to MongoDB.MongoDBSource.Builder<T>startupOptions(StartupOptions startupOptions)scan.startup.modeMongoDBSource.Builder<T>updateLookup(boolean updateLookup)change.stream.full.documentMongoDBSource.Builder<T>username(String username)Name of the database user to be used when connecting to MongoDB.
-
-
-
Method Detail
-
scheme
public MongoDBSource.Builder<T> scheme(String scheme)
The protocol connected to MongoDB. For example mongodb or mongodb+srv.
-
hosts
public MongoDBSource.Builder<T> hosts(String hosts)
The comma-separated list of hostname and port pairs of mongodb servers.
-
connectionOptions
public MongoDBSource.Builder<T> connectionOptions(String connectionOptions)
Ampersand (i.e. &) separated MongoDB connection options eg replicaSet=test&connectTimeoutMS=300000 https://docs.mongodb.com/manual/reference/connection-string/#std-label-connections-connection-options
-
username
public MongoDBSource.Builder<T> username(String username)
Name of the database user to be used when connecting to MongoDB.
-
password
public MongoDBSource.Builder<T> password(String password)
Password to be used when connecting to MongoDB.
-
databaseList
public MongoDBSource.Builder<T> databaseList(String... databaseList)
Regular expressions list that match database names to be monitored.
-
collectionList
public MongoDBSource.Builder<T> collectionList(String... collectionList)
Regular expressions that match fully-qualified collection identifiers for collections to be monitored. Each identifier is of the form<databaseName>.<collectionName>.
-
batchSize
public MongoDBSource.Builder<T> batchSize(int batchSize)
batch.sizeThe cursor batch size. Default: 1024
The change stream cursor batch size. Specifies the maximum number of change events to return in each batch of the response from the MongoDB cluster. The default is 0 meaning it uses the server's default value. Default: 0
-
pollAwaitTimeMillis
public MongoDBSource.Builder<T> pollAwaitTimeMillis(int pollAwaitTimeMillis)
poll.await.time.msThe amount of time to wait before checking for new results on the change stream. Default: 1000
-
pollMaxBatchSize
public MongoDBSource.Builder<T> pollMaxBatchSize(int pollMaxBatchSize)
poll.max.batch.sizeMaximum number of change stream documents to include in a single batch when polling for new data. This setting can be used to limit the amount of data buffered internally in the connector. Default: 1024
-
updateLookup
public MongoDBSource.Builder<T> updateLookup(boolean updateLookup)
change.stream.full.documentDetermines what to return for update operations when using a Change Stream. When set to true, the change stream for partial updates will include both a delta describing the changes to the document and a copy of the entire document that was changed from some time after the change occurred. Default: true
-
scanFullChangelog
public MongoDBSource.Builder<T> scanFullChangelog(boolean fullDocumentBeforeChange)
change.stream.full.document.before.changeConfigures the document pre-image your change stream returns on update operations. The pre-image is not available for source records published while copying existing data, and the pre-image configuration has no effect on copying.
-
copyExisting
@Deprecated public MongoDBSource.Builder<T> copyExisting(boolean copyExisting)
Deprecated.please usestartupOptionsinstead.copy.existingCopy existing data from source collections and convert them to Change Stream events on their respective topics. Any changes to the data that occur during the copy process are applied once the copy is completed.
-
startupOptions
public MongoDBSource.Builder<T> startupOptions(StartupOptions startupOptions)
scan.startup.modeOptional startup mode for MongoDB CDC consumer, valid enumerations are initial, latest-offset, timestamp. Default: initial
-
copyExistingMaxThreads
@Deprecated public MongoDBSource.Builder<T> copyExistingMaxThreads(int copyExistingMaxThreads)
Deprecated.useinitialSnapshottingMaxThreadsinstead.copy.existing.max.threadsThe number of threads to use when performing the data copy. Defaults to the number of processors. Default: defaults to the number of processors
-
initialSnapshottingMaxThreads
public MongoDBSource.Builder<T> initialSnapshottingMaxThreads(int initialSnapshottingMaxThreads)
initial.snapshotting.max.threadsThe number of threads to use when performing the data copy. Defaults to the number of processors. Default: defaults to the number of processors
-
copyExistingQueueSize
@Deprecated public MongoDBSource.Builder<T> copyExistingQueueSize(int copyExistingQueueSize)
Deprecated.useinitialSnapshottingQueueSizeinstead.copy.existing.queue.sizeThe max size of the queue to use when copying data. Default: 10240
-
initialSnapshottingQueueSize
public MongoDBSource.Builder<T> initialSnapshottingQueueSize(int initialSnapshottingQueueSize)
initial.snapshotting.queue.sizeThe max size of the queue to use when copying data. Default: 10240
-
copyExistingPipeline
@Deprecated public MongoDBSource.Builder<T> copyExistingPipeline(String copyExistingPipeline)
Deprecated.useinitialSnapshottingPipelineinstead.copy.existing.pipeline eg. [ { "$match": { "closed": "false" } } ]An array of JSON objects describing the pipeline operations to run when copying existing data. This can improve the use of indexes by the copying manager and make copying more efficient.
-
initialSnapshottingPipeline
public MongoDBSource.Builder<T> initialSnapshottingPipeline(String initialSnapshottingPipeline)
initial.snapshotting.pipeline eg. [ { "$match": { "closed": "false" } } ]An array of JSON objects describing the pipeline operations to run when copying existing data. This can improve the use of indexes by the copying manager and make copying more efficient.
-
heartbeatIntervalMillis
public MongoDBSource.Builder<T> heartbeatIntervalMillis(int heartbeatIntervalMillis)
heartbeat.interval.msThe length of time in milliseconds between sending heartbeat messages. Heartbeat messages contain the post batch resume token and are sent when no source records have been published in the specified interval. This improves the resumability of the connector for low volume namespaces. Use 0 to disable.
-
deserializer
public MongoDBSource.Builder<T> deserializer(DebeziumDeserializationSchema<T> deserializer)
The deserializer used to convert from consumedSourceRecord.
-
build
public DebeziumSourceFunction<T> build()
The properties of mongodb kafka connector. https://docs.mongodb.com/kafka-connector/current/kafka-source
-
-