How to set read timeout per query using Java REST

2019-08-30 18:04发布

问题:

I am using Neo4j 1.9.1 and Kernel 1.8, I want to specify read time out for few queries ...

Thanks in advance.

回答1:

I'm not sure if that is directly possible. You need to enable guards by config in your server and set a http header max-execution-time as described in Mark's blog post at http://www.markhneedham.com/blog/2013/10/17/neo4j-setting-query-timeout/.

Java Rest bindings need to be tweaked, see https://github.com/neo4j-contrib/java-rest-binding/blob/master/src/main/java/org/neo4j/rest/graphdb/ExecutingRestRequest.java#L102 for how to explicitly set an http header. The same thing can be done for max-execution-time.