I tried to make neo4j REST batching work via org.neo4j.rest.graphdb , but I have no clue, how it should work. Something I did:
final RestAPIFacade rest = new RestAPIFacade("http://localhost:7474/db/data");
BatchTransaction tx = BatchTransaction.begin(rest);
BatchRestAPI newrest = new BatchRestAPI("http://localhost:7474/db/data",rest);
try {
for (int i = 0; i < 1000; i++) {
newrest.createNode(null);
}
tx.success();
} finally {
tx.finish();
}
I understand that I could write my own rest requests constructor but it's not appropriate solution for what I need. Maybe someone has worked with this library and knows the right way. The problem is nothing changes in database, and no error appears.
Update: if I use a usual RestAPIFacade transaction and set
System.setProperty("org.neo4j.rest.batch_transaction", "true");
I get Premature EOF error.
Caused by: java.io.IOException: Premature EOF
at sun.net.www.http.ChunkedInputStream.readAheadBlocking(ChunkedInputStream.java:565)
at sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:609)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:696)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
So, one transaction seems to be limited to some size(nearly 700 empty nodes). So, is there a way increasing transaction size, or I should divide my data portions on many many transactions(so the performance, obviously, suffers)?
Thank you!