I'm using:
- spring-data-neo4j 4.2.0.BUILD-SNAPSHOT
- neo4j-ogm 2.1.1
- neo4j 3.0.8
and I'm having a problem with the X-Write HTTP header set by neo4j-ogm.
On write transactions, it is correctly set.
But I'm having a problem with read-only transactions. I have multiple calls to neo4j in my read-only transactions:
- POST .../db/data/transaction {"statements":[{"statement":"request1"}...]} (X-WRITE: true)
- POST .../db/data/transaction/1 {"statements":[{"statement":"request2"}...]} (X-WRITE: false)
- POST .../db/data/transaction/1 {"statements":[{"statement":"request3"}...]} (X-WRITE: false)
- ...
The problem is that the first request contains the X_WRITE header with the 'true' value. The next requests correctly have the header with the 'false' value.
So the first request is always sent to my master node and I'm not able to send the next requests on a slave node, because all requests inside a transaction must be sent to the same neo4j node.
Looking at neo4j-ogm source code, it seems it could maybe be due to HttpDriver.readOnly() method that is returning false when getCurrentTransaction() is null.