Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Reactive driver use

Node Clone


I would like to use the Neo4j Reactive driver with RxJava2 in a standard java program.

First question : is it relevant to use it in this case or should I use the "blocking style" session instead ?

If relevant, I see in the javadoc of RxSession#readTransaction this :

Returned publisher and given {@link RxTransactionWork} is completed/executed by an IO thread which should never block. Otherwise IO operations on this and potentially other network connections might deadlock. Please do not chain blocking operations like {@link CompletableFuture#get()} on the returned publisher and do not use them inside the RxTransactionWork.

So I would like to know if the use of blockingGet is allowed :

MyPOJO myPOJO = Flowable.using(
                    session -> session.readTransaction(tx ->"myQuery").records()),
                    session -> Observable.fromPublisher(session.close()).subscribe()
           .collect(() -> new MyPOJOBuilder(), MyPOJOBuilder::add)

If blockingGet cannot be used, how can I get back my POJO in a standard java program on the main thread ?