Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Neo4jHealthIndicator: Use read transaction instead of the session to execute the cypher query #31

Closed
microvish opened this issue Jul 14, 2020 · 1 comment · Fixed by #32
Assignees
Labels
enhancement New feature or request

Comments

@microvish
Copy link

Transactions can automatically handle transient errors using an automatic retry mechanism. This eliminates false positives health indicators especially where bolt routing is involved.

Reference: https://neo4j.com/docs/driver-manual/1.7/sessions-transactions/#driver-transactions-transaction-functions

Example: -

try (Session session = this.driver.session(DEFAULT_SESSION_CONFIG)) {
  session.readTransaction(transaction -> {
    final Result result = transaction.run(CYPHER);
    ...
  }
}
@michael-simons michael-simons self-assigned this Jul 29, 2020
@michael-simons
Copy link
Contributor

Good point.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants