• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Global Transactions in Spring

 
Ranch Hand
Posts: 401
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a requirement where we will receive some JMS messages in a queue, we will process the messages and then persist in the database. All of these operations must be executed in the transaction context. I understand this will involve the global transactions implementations. Please guide me how to achieve this using Spring framework.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Global Transaction is an application server managed transaction, allowing to work with different transactional resources (this might be two different database, database and message queue, etc)
 
Bartender
Posts: 1029
18
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you could start here; Spring Transaction Managment

Unless you really need them, then I've avoid global (XA) transactions and all the complexities of two phase commits.  Its all gets very complex and systems can suffer with performance issues.  Spring does offer support for global transaction management but the underling resources must support XA transactions.
 
Peter Rooke
Bartender
Posts: 1029
18
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would it not be far easier to use an application server with EJB's?  I hear that EJB3 is not as horrific as EJB2 (shudder those interfaces).    
 
sonai kale
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring transaction management tries to resolve the problem of both transactions. Consistent programming model approach can be used in any environment. Same code will work for different transactions management in different environment.
 
Vaibhav Gargs
Ranch Hand
Posts: 401
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can experts please suggest what is the best industry standard to accomplish the global/distributed transactions?
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The industry standard for global transactions is XA transactions with two-phase commit, as far as I know.

Peter Rooke wrote:Unless you really need them...



This is a decision that you have to make. If you need global transactions, then use them.
 
Vaibhav Gargs
Ranch Hand
Posts: 401
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Paul. I have read that there are certain libraries such as Atomikos , Bitronix which support XA transactions. Don't we get the global transaction support by Spring?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!