Transactions
Unit-of-work transactions are now documented as a shared Chronicle workflow with synchronized Kotlin and Java examples.
Kotlin client: IUnitOfWork
Section titled “Kotlin client: IUnitOfWork”Beyond commit/rollback, IUnitOfWork (from store.unitOfWorkManager)
exposes the outcome of a commit:
| Member | Use it for |
|---|---|
isSuccess |
Whether every staged event committed cleanly. |
getConstraintViolations |
Constraint violations detected on commit. |
getConcurrencyViolations |
Concurrency violations detected on commit. |
getAppendErrors |
Append errors detected on commit. |
tryGetLastCommittedEventSequenceNumber |
Highest sequence committed. |
onCompleted |
A callback invoked once commit or rollback completes. |
See the
EventStore API reference
for the full IUnitOfWork/IUnitOfWorkManager interfaces.
val unitOfWork = store.unitOfWorkManager.begin()unitOfWork.onCompleted { completed -> println("Unit of work ${completed.correlationId} completed")}