Hi, here is a simple code come from couchbase tutorial JDK2.1
My jdk is 1.8 and I have include couchbase-core-io-1.1.4.jar, couchbase-java-client-2.1.4.jar, rxjava-1.0.4.jar
Observable
.just(“doc-1”, “doc-2”, “doc-3”)
.flatMap(bucket::get)
.subscribe(document → System.out.println("Got: " + document));
But it can not compile with error message: Type mismatch: cannot convert from Observable to
And I fix it to
Observable
.just(“doc-1”, “doc-2”, “doc-3”)
.flatMap(bucket.async()::get)
.subscribe(document → System.out.println("Got: " + document));
It works but it’s not blocked until it get the data. That is, the cluster closed before it got the data
How to use toBlocking() in getting data and print it out?
I have tried it below but fail with compilation
Observable
.just(“doc-1”, “doc-2”, “doc-3”)
.flatMap(bucket.async()::get)
.subscribe(document → System.out.println("Got: " + document));
.toBlocking()
.single();