Skip to content

Instantly share code, notes, and snippets.

@daschl daschl/code.java
Created Feb 1, 2018

Embed
What would you like to do?
final Scope scope = env.tracer()
.buildSpan("query-and-fetch")
.startActive(true);
bucket.async()
.query(N1qlQuery.simple("select meta().id as id from `travel-sample` limit 10"), scope.span())
.flatMap(new Func1<AsyncN1qlQueryResult, Observable<AsyncN1qlQueryRow>>() {
public Observable<AsyncN1qlQueryRow> call(AsyncN1qlQueryResult result) {
return result.rows();
}
}).flatMap(new Func1<AsyncN1qlQueryRow, Observable<JsonDocument>>() {
public Observable<JsonDocument> call(AsyncN1qlQueryRow row) {
return bucket.async().get(row.value().getString("id"), scope.span(), JsonDocument.class);
}
})
.toBlocking()
.last();
scope.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.