My Library Docs

Multi-root Sidebar

flex-layout

  • Getting Started

  • Guides

  • Reference

typed-rx-http

  • Getting Started

  • Guides

  • Reference

global-rx-state

  • Getting Started

  • Guides

  • Reference

webflux-fe-dev-assistant

reactive-mongo-dsl

Transactions

Explains the MongoDB ClientSession transaction of getTxJob, Reactor Context session propagation, retry responsibilities, and Spring transaction boundaries.


getTxJob
java

getTxJob(...) opens a ClientSession with MongoExecutionContext.startSession(), starts a transaction, and binds the session to the Reactor Context. It processes in the order of commit on normal completion, abort on error/cancel, and finally closes the session.

Session scope

Transaction sessions are propagated only to the same DSL execution by MongoExecutionContext#getSessionScope(). The default DriverMongoExecutionContext uses its own MongoClient as the session scope.

Transaction retry is the responsibility of the caller.

getTxJob(...) does not automatically retry MongoDB transaction errors like TransientTransactionError. The decision to retry and the number of retries is determined by the calling application, which knows the idempotency of the operation, external side effects, and business rules.

Boundary with Spring transactions.

Spring @Transactional / TransactionalOperator.

The transaction/session boundary managed by Spring Data MongoDB.

ReactiveMongoDsl#getTxJob.

The DSL directly starts the ClientSession and passes it to the Reactor Context.

© 2026 Byeolnaerim. All rights reserved.IntroductionPrivacy Policy