`

spring 事务架构 - Spring Transaction Architecture

 
阅读更多

Spring Transaction Architecture

 

 

Deployment options

As shown below, there are two fundamentally different ways of deploying an application that uses Spring transactions:

 

  • Standalone Spring container
  • J2EE container deployment

 

 

Spring Transaction Architecture

 

 

 

 

Standalone Spring container

In the standalone deployment model, the Spring container is provides access to persistent data sources and is responsible for managing the transactions associated with those data sources. A notable limitation of the standalone model is that the Spring container can support only local transaction managers, which means that only one data source (resource) at a time can participate in a transaction.

 

 

Data source

Spring supports a variety of different wrapper APIs for accessing persistent storage. For example, to access a database through JDBC, Spring provides the SimpleDriverDataSource class to represent the database instance and the JdbcTemplate class to provide access to the database using SQL. Wrappers are also provided for other kinds of persistent resource, such as JMS, Hibernate, and so on. The Spring data sources are designed to be compatible with the local transaction manager classes.

 

 

Local transaction manager

In Spring, a local transaction manager is a wrapper class that is responsible for managing the transactions of a single resource. The local transaction manager is responsible for starting, committing, and rolling back transactions. Typically, the way that you use a transaction manager in Apache Camel is that you pass the transaction manager reference to a transactional Apache Camel component bean.

Spring provides different types of local transaction manager for different types of data source. For example, Spring provides a DataSourceTransactionManager for JDBC, a JmsTransactionManager for JMS, a HibernateTransactionManager for Hibernate, and so on.

 

 

J2EE container deployment

In the J2EE deployment model, the Spring container is nested inside a J2EE application server. The advantage of this deployment model is that the Spring container can leverage the transaction management capabilities of the J2EE container. In particular, the Spring container can now access global transactions, which means that multiple resources can participate in a single transaction.

 

 

XA resources

In a J2EE deployment, the persistent resources should be integrated directly with J2EE. In other words, you do not use Spring data sources in this case. Moreover, in order to enable global transactions, you register each resource's XA interface with the JTA transaction manager in the J2EE environment.

 

 

JTA transaction manager

The Java Transaction API (JTA) and the Java Transaction Service define respectively the API and the implementation of a transaction manager for the J2EE platform. A full implementation of the JTA transaction manager can potentially provide enterprise-level transaction features, including support for global transactions, XA resources, and (in some cases) distributed transactions.

 

 

Global transaction manager

To access J2EE global transactions from within the Spring environment, the Spring container provides the JtaTransactionManager class, which is essentially just a thin wrapper around the JTA transaction manager. In fact, the JTA transaction manager is completely configured within the J2EE environment. If required, you can instantiate the Spring wrapper class, JtaTransactionManager, by obtaining a reference to the existing JTA transaction manager in J2EE, typically using a JNDI lookup.

 

For detail, open this url: 

http://fusesource.com/docs/router/2.4/transactions/TxnManagers-SpringArchitecture.html#TxnManagers-SpringArchitecture-Standalone

 


分享到:
评论

相关推荐

    springcloud-eureka-feign-mybatis-seata.zip

    而Seata(前身是FATBOY和SEATA)是阿里巴巴开源的分布式事务解决方案,全称是Simple Extensible Autonomous Transaction Architecture,意为简单可扩展的自主事务架构。Seata支持AT(Automatic Transaction)、TCC...

    Spring-cloud-alibaba Demo

    3. **Seata**:全称 Simple Extensible Autonomous Transaction Architecture,是阿里巴巴开源的分布式事务解决方案,它支持全局事务的ACID特性,解决了微服务场景下分布式事务处理的难题。 4. **Sentinel**:这是...

    《Spring Cloud Alibaba微服务原理与实战》中的的案-Spring-Cloud-Alibaba-.zip

    4. **Seata**:Seata(Simple Extensible Autonomous Transaction Architecture)是阿里巴巴开源的分布式事务解决方案,致力于提供高性能和简单易用的分布式事务服务。在案例中,Seata可以帮助我们处理分布式环境下...

    第六期微服务架构-SpringCloudAlibaba代码和文档.zip

    3. **Seata**:Seata(Simple Extensible Autonomous Transaction Architecture)是阿里开源的分布式事务解决方案,它支持AT、TCC、SAGA和XA等多种分布式事务模式,解决了在分布式环境下的事务一致性问题。...

    spring-boot-starter-seata

    Seata(Simple Extensible Autonomous Transaction Architecture)是由阿里开源的一款分布式事务解决方案,它集成了AT(二阶段提交)、TCC(尝试、确认、补偿)以及Saga(长事务)等多种事务模式,为开发者提供了...

    Java学习SpringCloud - 整合Seata实现分布式事务

    而Seata(Simple Extensible Autonomous Transaction Architecture)则是一个高性能、轻量级的开源分布式事务解决方案,它旨在解决微服务环境下的分布式事务问题。本篇文章将详细探讨如何在Spring Cloud项目中整合...

    Spring+JOTM 分布式事务管理

    Spring框架作为一个广泛使用的Java应用程序开发框架,提供了多种支持事务管理的解决方案,其中包括集成JOTM(Java Open Transaction Manager)来处理分布式事务。本文将深入探讨Spring与JOTM结合使用的知识点,帮助...

    hello-spring-cloud-alibaba:spring-cloud-alibaba学习

    Seata(Simple Extensible Autonomous Transaction Architecture)是阿里巴巴开源的分布式事务解决方案,它实现了ACID(原子性、一致性、隔离性和持久性)特性,提供了AT(两阶段提交)、TCC(尝试、确认、补偿)...

    transaction-seate.rar

    Seata,全称Simple Extensible Autonomous Transaction Architecture,是一个开源的分布式事务解决方案,致力于提供高性能和简单易用的分布式事务服务。它旨在解决微服务架构下的分布式事务问题,支持AT(两阶段提交...

    springcloud-mybatis.zip

    Seata是一款开源的分布式事务解决方案,它的全称是Simple Extensible Autonomous Transaction Architecture,即简单可扩展的自治事务架构。Seata包含了三个核心组件:TM(Transaction Manager)、RM(Resource ...

    spring spring transtration

    5. **Manager, Architecture**:架构师需要设计事务管理的全局策略,比如是否使用全局事务(JTA)还是本地事务,以及如何在微服务架构中协调事务。 6. **IT Service Continuity Manager**:IT服务连续性经理关注...

    阿里巴巴springcloud全家桶项目

    3. **Seata**:全名为Simple Extensible Autonomous Transaction Architecture,是一个开源的分布式事务解决方案,致力于提供高性能和简单易用的分布式事务服务。Seata包含了AT、TCC、Saga和XA四种分布式事务模式。 ...

    seata-2.0.0

    Seata(Simple Extensible Autonomous Transaction Architecture)是一款开源的分布式事务解决方案,主要致力于提供高性能和简单易用的分布式事务服务。2.0.0版本的发布标志着Seata在功能、性能和稳定性上有了显著的...

    Spring.Essentials.178398

    Explore Spring's comprehensive transaction support for declarative Transaction Management and its integration with Spring's data access abstractions Investigate Spring Data access mechanisms with ...

    阿里开源 分布式事务解决方案 seata-samples-master.zip

    阿里开源的Seata(Simple Extensible Autonomous Transaction Architecture)是一个全球分布式事务解决方案,旨在提供高性能和简单易用的分布式事务服务。Seata-samples-master.zip是一个包含多种技术集成示例的...

    Spring和Mybatis整合英文文档翻译.pdf

    It streamlines configuration, exception handling, and transaction management while providing a clean and modular architecture. By leveraging the power of both frameworks, developers can build robust,...

    seata 1.7 基于springcloud 和nacos搭建的客户端

    Seata 的全称是 Simple Extensible Autonomous Transaction Architecture,即简单可扩展的自主事务架构。在本项目中,我们将基于 Seata 1.7 版本,结合 Spring Cloud 和 Nacos 来搭建一个客户端,实现 AT 模式的...

    纯spring多库

    在Spring中集成Atomikos,可以让应用程序具备处理XA(eXtended Architecture)事务的能力,即使在分布式环境中也能保证ACID(原子性、一致性、隔离性和持久性)特性。Atomikos通过实现JTA接口,使得Spring的`...

    开源分布式事务解决方案-Seata,1.0.0版发布了.docx

    Seata,全称为Simple Extensible Autonomous Transaction Architecture,是一个开源的分布式事务解决方案,它旨在为微服务提供高性能和易用的分布式事务服务。Seata的发展历程可以从它的前身TXC、GTX、Fescar中看出...

Global site tag (gtag.js) - Google Analytics