j2ee‎ > ‎

JDBC/JMS transaction Integration using spring

posted Jun 20, 2010, 7:39 PM by Kuwon Kang
Spring이 delegate하는 JtaTransactionManager를 통해 JDBC와 JMS transaction을 JTA로 묶는 아키텍처를 적용하였다.

아래 글은 Sun의 JMS Specification이다.

아래 글처럼 JTA를 통해 jdbc api와 통합되고 더 나아가 분산 트랜젝션 처리까지 위임이 된다.

1.4 Relationship to Other Java APIs

1.4.1 Java DataBase Connectivity (JDBCTM) Software

JMS clients may also use the JDBC API. They may desire to include the use of

both the JDBC API and the JMS API in the same transaction. In most cases, this

will be achieved automatically by implementing these clients as Enterprise

JavaBeansTM components. <strong>It is also possible to do this directly with the Java</strong>

<strong>Transaction API (JTA).</strong>

18 Java Message Service — Version 1.1 April 12, 2002

1

1.4.2 JavaBeansTM Components

JavaBeans components can use a JMS session to send/receive messages. JMS

itself is an API and the interfaces it defines are not designed to be used directly

as JavaBeans components.

1.4.3 Enterprise JavaBeansTM Component Model

The JMS API is an important resource available to Enterprise Java Beans

(EJBTM) component developers. It can be used in conjunction with other

resources like JDBC to implement enterprise services.

The EJB 2.0 specification defines beans that are invoked synchronously via

method calls from EJB clients. It also defines a form of asynchronous bean that

is invoked when a JMS client sends it a message, called a message-driven bean.

The EJB specification supports both synchronous and asynchronous message

consumption. In addition, EJB 2.0 specifies how the JMS API participates in

bean-managed or container-managed transactions. The EJB 2.0 specification

restricts how to use JMS interfaces when implementing EJB clients. Refer to the

EJB 2.0 specification for the details.

1.4.4 Java Transaction API (JTA)

The javax.transaction package provides a client API for delimiting distributed

transactions and an API for accessing a resource’s ability to participate in a

distributed transaction.

<strong>A JMS client may use JTA to delimit distributed transactions; however, this is a</strong>

<strong>function of the transaction environment the client is running in. It is not a</strong>

<strong>feature of JMS.</strong>

A JMS provider can optionally support distributed transactions via JTA.

1.4.5 Java Transaction Service (JTS)

JMS can be used in conjunction with JTS to form distributed transactions that

combine message sends and receives with database updates and other JTS

aware services. Distributed transactions should be handled automatically when

a JMS client is run from within an application server such as an Enterprise

JavaBeans server; however, it is also possible for JMS clients to program them

explicitly.
Comments