Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-25-2021 01:16 AM
Hi,
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(
driver::rxSession,
session -> session.readTransaction(tx -> tx.run("myQuery").records()),
session -> Observable.fromPublisher(session.close()).subscribe()
)
.map(FROM_RECORD_TO_POJO)
.collect(() -> new MyPOJOBuilder(), MyPOJOBuilder::add)
.map(myPOJOBuilder::build)
.blockingGet();
If blockingGet cannot be used, how can I get back my POJO in a standard java program on the main thread ?
Thanks
All the sessions of the conference are now available online