Modifier and Type | Field and Description |
---|---|
static RetryStrategy |
DEFAULT_COMMIT_RETRY_STRATEGY
Default retry strategy used by the processors.
|
static com.mongodb.TransactionOptions |
DEFAULT_TRANSACTION_OPTION
Default transaction options used by the processors.
|
Modifier and Type | Method and Description |
---|---|
Sink<T> |
build()
Creates and returns the MongoDB
Sink with the components you
supplied to this builder. |
MongoSinkBuilder<T> |
commitRetryStrategy(RetryStrategy commitRetryStrategy)
Sets the retry strategy in case of commit failure.
|
MongoSinkBuilder<T> |
identifyDocumentBy(String fieldName,
FunctionEx<T,Object> documentIdentityFn)
Sets the filter that decides which document in the collection is equal to processed document.
|
MongoSinkBuilder<T> |
into(FunctionEx<T,String> selectDatabaseNameFn,
FunctionEx<T,String> selectCollectionNameFn) |
MongoSinkBuilder<T> |
into(String databaseName,
String collectionName) |
MongoSinkBuilder<T> |
preferredLocalParallelism(int preferredLocalParallelism)
|
MongoSinkBuilder<T> |
throwOnNonExisting(boolean throwOnNonExisting)
If
true , the lack of database or collection will cause an error. |
MongoSinkBuilder<T> |
transactionOptions(SupplierEx<com.mongodb.TransactionOptions> transactionOptionsSup)
Sets options which will be used by MongoDB transaction mechanism.
|
MongoSinkBuilder<T> |
withCustomReplaceOptions(ConsumerEx<com.mongodb.client.model.ReplaceOptions> adjustConsumer)
Provides an option to adjust options used in replace action.
|
MongoSinkBuilder<T> |
writeMode(WriteMode writeMode)
Sets write mode used by the connector.
|
public static final com.mongodb.TransactionOptions DEFAULT_TRANSACTION_OPTION
public static final RetryStrategy DEFAULT_COMMIT_RETRY_STRATEGY
@Nonnull public MongoSinkBuilder<T> into(@Nonnull FunctionEx<T,String> selectDatabaseNameFn, @Nonnull FunctionEx<T,String> selectCollectionNameFn)
selectDatabaseNameFn
- selects database name for each item individuallyselectCollectionNameFn
- selects collection name for each item individually@Nonnull public MongoSinkBuilder<T> into(@Nonnull String databaseName, @Nonnull String collectionName)
databaseName
- database name to which objects will be inserted/updated.collectionName
- collection name to which objects will be inserted/updated.@Nonnull public MongoSinkBuilder<T> preferredLocalParallelism(int preferredLocalParallelism)
@Nonnull public MongoSinkBuilder<T> withCustomReplaceOptions(@Nonnull ConsumerEx<com.mongodb.client.model.ReplaceOptions> adjustConsumer)
@Nonnull public MongoSinkBuilder<T> identifyDocumentBy(@Nonnull String fieldName, @Nonnull FunctionEx<T,Object> documentIdentityFn)
fieldName
- field name in the collection, that will be used for comparisondocumentIdentityFn
- function that extracts ID from given item; will be compared against fieldName
@Nonnull public MongoSinkBuilder<T> commitRetryStrategy(@Nonnull RetryStrategy commitRetryStrategy)
MongoDB by default retries simple operations, but commits must be retried manually.
This option is taken into consideration only if ProcessingGuarantee.EXACTLY_ONCE is used.
Default value is DEFAULT_COMMIT_RETRY_STRATEGY.
@Nonnull public MongoSinkBuilder<T> transactionOptions(@Nonnull SupplierEx<com.mongodb.TransactionOptions> transactionOptionsSup)
This option is taken into consideration only if ProcessingGuarantee.EXACTLY_ONCE is used.
Default value is DEFAULT_TRANSACTION_OPTION.
@Nonnull public MongoSinkBuilder<T> writeMode(@Nonnull WriteMode writeMode)
@Nonnull public MongoSinkBuilder<T> throwOnNonExisting(boolean throwOnNonExisting)
true
, the lack of database or collection will cause an error.
If false
, database and collection will be automatically created.
Default value is true
.throwOnNonExisting
- if exception should be thrown when database or collection does not exist.Copyright © 2024 Hazelcast, Inc.. All rights reserved.