transactions-java
Installation
SKILL.md
Couchbase Transactions — Java
ACID multi-document transactions. All operations commit atomically or roll back entirely.
Version requirement: Distributed transactions require Couchbase Server 7.0+. The 6.6 developer preview is not recommended for production.
Bank Transfer Example
import com.couchbase.client.java.transactions.error.TransactionFailed;
cluster.transactions().run((ctx) -> {
TransactionGetResult sender = ctx.get(collection, "acct_alice");
TransactionGetResult receiver = ctx.get(collection, "acct_bob");
JsonObject senderDoc = sender.contentAsObject();
JsonObject receiverDoc = receiver.contentAsObject();