I use couchbase in Spring Webflux project.
When client call API, I want to search from couchbase and return the results asynchronously.
bucket
.async()
.query(ViewQuery.from("my_design_doc", "my_view"))
.flatMap(AsyncViewResult::rows)
.flatMap(AsyncViewRow::document)
.flatMap(doc-> rx.Observable.just(doc.content()))
.map(list-> {
someFunction(list);
return list;
)
.toblocking()
.single();
The code above returns List of JsonObject. I know that To call toblocking() function is Synchronization and it is generally inappropriate for production applications. Is there a way to act asynchronously??
and this code is good way to use in production applications?? plz help me.