Execute f
in a transaction.
Execute f
in a transaction.
If f
throws an exception, the transaction is rolled back. Otherwise, the transaction is
committed.
client.transaction[Foo] { c => for { r0 <- c.query(q0) r1 <- c.query(q1) response: Foo <- buildResponse(r1, r2) } yield response }
we use a ServiceFactory that returns the same Service repeatedly to the client. This is to assure that a new MySQL connection (i.e. Service) from the connection pool (i.e., ServiceFactory) will be used for each new transaction. Only upon completion of the transaction is the connection returned to the pool for re-use.