public static class TransactionsConfig.Builder extends Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
com.couchbase.client.core.transaction.config.CoreTransactionsConfig |
build() |
TransactionsConfig.Builder |
cleanupConfig(TransactionsCleanupConfig.Builder config)
Configures transaction cleanup.
|
TransactionsConfig.Builder |
durabilityLevel(com.couchbase.client.core.msg.kv.DurabilityLevel level)
All transaction writes will be performed with this durability setting.
|
TransactionsConfig.Builder |
metadataCollection(TransactionKeyspace collection)
Allows setting a custom collection to use for any transactional metadata documents.
|
TransactionsConfig.Builder |
queryConfig(TransactionsQueryConfig.Builder queryConfig)
Sets the default query configuration for all transactions.
|
TransactionsConfig.Builder |
timeout(Duration timeout)
Sets the maximum time that transactions can run for.
|
@Stability.Internal public com.couchbase.client.core.transaction.config.CoreTransactionsConfig build()
public TransactionsConfig.Builder cleanupConfig(TransactionsCleanupConfig.Builder config)
public TransactionsConfig.Builder timeout(Duration timeout)
TransactionExpiredException
error.
Applications can increase or decrease this as desired. The trade-off to understand is that documents that are
being mutated in a transaction A, are effectively locked from being updated by other transactions until
transaction A has completed - committed or rolled back. If transaction A is unable to complete for whatever
reason, the document can be locked for this expirationTime
time.
It is worth noting that this setting does not completely guarantee that the transaction will immediately be completed after that time. In some rare cases, such as application crashes, it may take longer as the lost transactions cleanup process will be involved.
public TransactionsConfig.Builder durabilityLevel(com.couchbase.client.core.msg.kv.DurabilityLevel level)
All writes in Couchbase go initially to one primary node, and from their fan-out to any configured replicas.
If durability is disabled then the transaction will continue as soon as the write is available on the primary node. The durability setting will ensure the transaction does not continue until the write is available in more places. This can provide a small degree of extra security in the advent of node loss.
The default setting is DurabilityLevel.MAJORITY, meaning a transaction will pause on each write until it is available in-memory on a majority of configured replicas.
public TransactionsConfig.Builder metadataCollection(TransactionKeyspace collection)
If not set, it will default to creating these documents in the default collection of the bucket that the first mutated document in the transaction is on.
This collection will be added to the set of collections being cleaned up.
public TransactionsConfig.Builder queryConfig(TransactionsQueryConfig.Builder queryConfig)
queryConfig
- the query configuration to useCopyright © 2024 Couchbase, Inc.. All rights reserved.