cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

RxResult with Read & Write Transaction

Hello !

I am currently testing neo4j inside a async framework

Reading of node is done with this code

fun <T> read(query: String, action: Action<T>): Multi<T> =
        Multi.createFrom().resource(driver::rxSession) { rxs ->
            rxs.readTransaction { tx ->
                val rs = tx.run(query.trimIndent())
                Multi.createFrom().publisher(rs.records()).map {
                    action(it)
                }
            }
        }.withFinalizer(Consumer { it.uniClose() })

What I do not understand is when I want to update I changed the code to a write transaction with this query

MATCH (d:Descriptable {key:"Robbie"}) 
                SET d.title = '01ESKEPEMRXHVQ1PN3SQWCE2Z8' 
                RETURN d

It is the same query than read but read is working but write never start the publisher
It emits nothing like there is no record !!!
but the exact query run into the browser and return a result

fun <T> write(query: String, action: Action<T>): Multi<T>  =
        Multi.createFrom().resource(driver::rxSession) { rxs ->
            rxs.writeTransaction { tx ->
                val rs = tx.run(query.trimIndent())
                Multi.createFrom().publisher(rs.records()).map {
                    action(it)
                }
            }
        }.withFinalizer(Consumer { it.uniClose() })

What do I miss ???

Regards
Robert

1 REPLY 1

Don't you need to start consuming from the reactive type?

So when your downstream consumer starts reading from the multi it should do the update.