Skip to content

Commit

Permalink
feat: Make transaction retry timeout configurable. (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-simons authored May 3, 2023
1 parent 57209b2 commit 2b912e5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-neo4j.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -43,6 +44,7 @@ public RuntimeValue<Driver> 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);
Expand Down

0 comments on commit 2b912e5

Please sign in to comment.