Search code examples
javaspringjakarta-eeremotingapplication-server

Spring remote services with a transaction context



I have the following scenario:
I have an interface-server which listens on a queue and receives messages from the "outside world". This server then calls a "internal", business, service which in turn calls other services and so on.
These services can each reside on a different machine, and can be clustered for that matter.
I need the notion of a transaction to span across these services and machines.
My development stack includes Spring (3.0.5) and JPA 2.0(Hibernate in background) on a J2SE environment.
Can I acheive this without an app-server? Assuming I plug-in an external JTA transaction-manager (like atomikos for example)
We've chosen to go with Spring for many reasons the most important ones were the service abstractions, intensive DI and the ability to work without a heavy app-server. I know we can use spring in an app-server but if someone is to recommend this I'd like to hear why this should be done, assuming I can forefit spring and go all app-server.

BTW, just to reassure anyone reading this post: Yes, we've thought of the problematic issues of a distributed transaction but we still think we will need such a transaction as this is the business logic of the service and it will need to be across machine as some of the services will be under a lot of pressure.

Thanks in advance,
Ittai


Solution

  • We ended up using JBoss with Spring.
    JBoss indeed supplied the distributed transactions that were needed while Spring contained all DI and such.
    We still kept spring as we felt its IOC was cleaner and more comfortable.
    It is possible we should have used CDI in jboss but that was not on our radar.