October 2018
Intermediate to advanced
556 pages
15h 18m
English
The best way to implement a distributed business transaction in a microservice environment is through an event-driven architecture, which we have explored a few times throughout this book so far.
If it is required to change the state of the system, the first service changes its data in its own database, and the same inner transaction publishes an event to a message broker. So, even if transactions are involved, they do not cross the boundary of the service. The second service, which registers the subscription to the required type of events, receives events and changes its storage accordingly, as well as possibly sending an event. The services are not blocked together and do not depend on each other; the only coupling ...