diff --git a/docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc b/docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc index ca4c60e..0d36201 100644 --- a/docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc +++ b/docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc @@ -122,6 +122,23 @@ endif::add-copy-button-to-env-var[] |`false` +a| [[quarkus-neo4j_quarkus.neo4j.max-transaction-retry-time]]`link:#quarkus-neo4j_quarkus.neo4j.max-transaction-retry-time[quarkus.neo4j.max-transaction-retry-time]` + +[.description] +-- +Configure the maximum time transactions are allowed to retry. + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_NEO4J_MAX_TRANSACTION_RETRY_TIME+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_NEO4J_MAX_TRANSACTION_RETRY_TIME+++` +endif::add-copy-button-to-env-var[] +--|link:https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html[Duration] + link:#duration-note-anchor-{summaryTableId}[icon:question-circle[], title=More information about the Duration format] +|`30S` + + a|icon:lock[title=Fixed at build time] [[quarkus-neo4j_quarkus.neo4j.devservices.additional-env-additional-env]]`link:#quarkus-neo4j_quarkus.neo4j.devservices.additional-env-additional-env[quarkus.neo4j.devservices.additional-env]` [.description] diff --git a/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jConfiguration.java b/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jConfiguration.java index 64ae5e4..90e60e8 100644 --- a/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jConfiguration.java +++ b/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jConfiguration.java @@ -46,6 +46,12 @@ public class Neo4jConfiguration { @ConfigDocSection public TrustSettings trustSettings; + /** + * Configure the maximum time transactions are allowed to retry. + */ + @ConfigItem(defaultValue = "30S") + public Duration maxTransactionRetryTime; + /** * Connection pool. */ diff --git a/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorder.java b/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorder.java index b266a1f..529523b 100644 --- a/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorder.java +++ b/runtime/src/main/java/io/quarkus/neo4j/runtime/Neo4jDriverRecorder.java @@ -5,6 +5,7 @@ import java.net.URI; import java.util.Optional; import java.util.Set; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.logging.Level; @@ -43,6 +44,7 @@ public RuntimeValue initializeDriver(Neo4jConfiguration configuration, S Config.ConfigBuilder configBuilder = createBaseConfig(); configureSsl(configBuilder, configuration); configurePoolSettings(configBuilder, configuration.pool); + configBuilder.withMaxTransactionRetryTime(configuration.maxTransactionRetryTime.toMillis(), TimeUnit.MILLISECONDS); Driver driver = GraphDatabase.driver(uri, authToken, configBuilder.build()); shutdownContext.addShutdownTask(driver::close);