transactions-scala
Installation
SKILL.md
Transactions — Scala
Transactions are ACID, multi-document, and automatically retried on transient failures. The lambda may run more than once — keep it idempotent and free of side effects.
Version requirement: Distributed transactions require Couchbase Server 7.0+. The 6.6 developer preview is not recommended for production.
Basic Transaction
import com.couchbase.client.scala.transactions._
import com.couchbase.client.scala.json.JsonObject
import scala.util.{Success, Failure}
val inventory = cluster.bucket("travel-sample").scope("inventory")
val result = cluster.transactions.run { ctx =>
// Insert
ctx.insert(collection, "doc-a", JsonObject("status" -> "new")).get