Reactive transactions

A transaction is a marker for a database that defines the boundaries of a single unit with many logical operations that should be performed atomically. So, we have a point in time when a transaction is initialized, then some operations are happening with regard to the transaction object, then a decision moment happens. At that moment, the client and the database decide whether a transaction should be successfully committed or rolled back.

In the synchronous world, a transaction object is often held in the ThreadLocal container. However, ThreadLocal isn't suitable for associating data with a reactive flow as the user has no control over thread switching. A transaction requires binding of the underlying resource to the materialized flow. With Project Reactor, this is achieved best by leveraging the Reactor Context, described in Chapter 4, Project Reactor - the Foundation for Reactive Apps.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.55.198