Ondra Chaloupka created JBTM-2920:
Summary: Investigate the use of transactions within a reactive microservices
Project: JBoss Transaction Manager
Issue Type: Task
Reporter: Ondra Chaloupka
Investigate the use of a transaction manager when used within a reactive microservices
Reactive microservice architecture is a trending architectural pattern. The reactive
architecture could simply be defined as a system where messages are sent to a jms queue or
a specialized event storage and other services are registered to, for being notified when
an event is generated to be able to react on it. Synchronous calls from a service to a
service are not meant to be a good practice in such system. Here all the communication
between services is done with message passing through the event storage.
Such a system is expected to decouple data  where each microservice manages data, which
needs for working, on its own. Still there are cases where some data coordination is
needed. As the all communication is asynchronous there isn’t place for synchronous 2PC.
The good fit seems to be the Saga transactions. We lost ACID consistency and needs to
stay with eventual consistency but handling of them is fitting to the message driven
system. The way of understanding Saga in microservice world could be overviewed at .
Narayana transaction manager is good in managing Saga transactions where having long
history experience from running it for WS or managing consistency in NoSQL
But Narayana is designed to manage transactions in synchronous way. The transaction
context is normally passed along a RPC call where the transaction is finished after such
synchronous call is returned back to the caller.
h2. Steps to go
The point here is to investigate on the topic of usage Saga in reactive architecture,
gather working solutions - especially in Java world (some references eg.
), get experience in how they are working and on top of this
experience considering implementation of the reactive approach with Narayana. It may be
that Narayana requires some modification to execute optimally for such task and then it’s
up to reconsideration if some greenfield implementation should be started. As the last
step there should be created some sample project (ie. quickstart) where the usage of the
implementation would be shown.
With that we expect usage of projects in Red Hat portfolio. We can expect the need for an
event storage system (a.k.a. A scalable transaction log) - as an original thought let’s
consider the AMQ7 message broker or the Infinispan. The sample project would be probably
implemented with usage of the Vert.x.
h2. Expected output
The expected output of this effort is
* A research document with state of the art.
** Overview of what are the problem of the synchronous/blocking approach.
** What are the other approaches that people have to this problem,
* A proof-of-concept implementation
** Preferably with use of Narayana transaction manager prepare a service capable to manage
transactions in world of reactive microservices
* An example/quickstart showing this in practical terms
** A proof that a transaction manager can be made to work in an asynchronous environment.
For example if you have a Vert.x event and it has to commit a transaction. The handler for
that message currently does sync ops with transaction manager and that blocks. One of the
goals for the project is to prevent blocking of threads in an async environment.
2017, The Many Meanings of Event-Driven Architecture, Martin Fowler)
(Reactive Microservices Architecture)
(The Hardest Part About Microservices: Your Data)
] (Sagas paper)
] (Eventual Consistency Today: Limitations,
Extensions, and Beyond)
] (Life Beyond Distributed Transactions)
] (Narayana doc, WS-Business
(Bringing Transactional Guarantees to MongoDB)
] (Distributed Sagas: A Protocol for
Coordinating Microservices - Caitie McCaffrey - JOTB17)
] (Using sagas to maintain data
consistency in a microservice architecture by Chris Richardson)
] (.NET NServiceBus Saga)
] (Dr. Roland Kuhn: Reactive Design
] (Pattern: Saga)
This message was sent by Atlassian JIRA