aeruhxi
04/18/2018, 6:41 AMval post = it.writeTransactionAsync {
it.runAsync(query, parameters("postId", postId, "userId", userId, "timestamp", System.currentTimeMillis()))
.thenCompose(StatementResultCursor::peekAsync)
.thenApply { record ->
Option.fromNullable(record).map { Tuple2(it["post"]["id"].asString(), it["poster"]["id"].asString()) }
}
}.await()
val likesCount = post.map {
session.readTransactionAsync { tx ->
tx.runAsync(notificationQuery, parameters("postId", it.a))
.thenCompose(StatementResultCursor::peekAsync)
.thenApply { record ->
record["likesCount"].asInt()
}
}.await()
}
Something like this