java.lang.Object
org.neo4j.driver.TransactionConfig.Builder
- Enclosing class:
- TransactionConfig
Builder used to construct
transaction configuration
objects.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the transaction configuration object using the specified settings.Set the transaction timeout to the server-side configured default timeout.withMetadata
(Map<String, ?> metadata) Set the transaction metadata.withTimeout
(Duration timeout) Set the transaction timeout.
-
Method Details
-
withTimeout
Set the transaction timeout. Transactions that execute longer than the configured timeout will be terminated by the database. See alsowithDefaultTimeout()
.This functionality allows user code to limit query/transaction execution time. The specified timeout overrides the default timeout configured in the database using the
db.transaction.timeout
setting (dbms.transaction.timeout
before Neo4j 5.0). Values higher thandb.transaction.timeout
will be ignored and will fall back to the default for server versions between 4.2 and 5.2 (inclusive).The provided value should not represent a negative duration.
Duration.ZERO
will make the transaction execute indefinitely.- Parameters:
timeout
- the timeout.- Returns:
- this builder.
-
withDefaultTimeout
Set the transaction timeout to the server-side configured default timeout. This is the default behaviour ifwithTimeout(java.time.Duration)
has not been called. See alsowithTimeout(java.time.Duration)
.- Returns:
- this builder.
-
withMetadata
Set the transaction metadata. Specified metadata will be attached to the executing transaction and visible in the output ofdbms.listQueries
anddbms.listTransactions
procedures. It will also get logged to thequery.log
.This functionality makes it easier to tag transactions and is equivalent to
dbms.setTXMetaData
procedure.Provided value should not be
null
.- Parameters:
metadata
- the metadata.- Returns:
- this builder.
-
build
Build the transaction configuration object using the specified settings.- Returns:
- new transaction configuration object.
-