Practical Microservices Architectural Patterns by Binildas Christudas
Author:Binildas Christudas
Language: eng
Format: epub
ISBN: 9781484245019
Publisher: Apress
Distributed Transactions Revisited
Before you look into concrete examples, you need to understand a few concepts that will set the context for the examples you will explore.
Local Transactions
If you take a typical resource manager, typically that single resource will be confined to a single host or node (even though that may not be the case mandatorily). Operations confined to such a single resource are local transactions and they affect only one transactional resource. Within a single node, there are less (or for practical considerations, nil) nondeterministic operations, hence a command sent to a single node must be considered deterministic, and in case of any catastrophes, there are local recovery mechanisms. These resources have their own transactional APIs, and the notion of a transaction is often exhibited as the concept of a session, which can encapsulate a unit of work with demarcating APIs to tell the resource when the buffered work should be committed to the underlying resource. Thus, from a developer perspective, you do not manage with transactions in a local transaction, but with just “connections.”
The java.sql.Connection interface is a transactional resource that can wrap a database. By default, a Connection object is in auto-commit mode, which means that it automatically commits changes after executing each statement. If auto-commit mode is disabled, the method commit must be called explicitly in order to commit changes; otherwise, database changes will not be saved. It is preferable to collect several related statements into a batch and then commit all, or none, when you have more than one statement. You do this by first setting the Connection’s setAutoCommit() method to false and later explicitly calling Connection.commit() or Connection.rollback() at the end of the batch. See Listing 13-1.try{
connection.setAutoCommit(false);
Statement statement = conn.createStatement();
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12579)
Hello! Python by Anthony Briggs(9917)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9780)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8303)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7698)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7100)
Microservices with Go by Alexander Shuiskov(6870)
Practical Design Patterns for Java Developers by Miroslav Wengner(6783)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6725)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Angular Projects - Third Edition by Aristeidis Bampakos(6140)
The Art of Crafting User Stories by The Art of Crafting User Stories(5660)
NetSuite for Consultants - Second Edition by Peter Ries(5595)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5404)
Kotlin in Action by Dmitry Jemerov(5067)
