I currently have a set of ERP style web applications build on top spring 3. The application is deployed into tomcat 7.
The system developed some time ago without a cleanly defined architecture. Each Application has 3 parts (as sub projects). API: Defining Models and Interfaces, IMPL: The Service Layer, and the WEB.
Current layout of system is as below.
Financial API+IMPL is included to Inventory module for achieving transaction management. We previously tried to separate inventory and financial into different Web apps by using REST calls but faced issue with transaction management. What we are currently doing is @Autowiring the financial Impl directly to Inventory services. For instance, When a Sale invoice is made, both financial and inventory operations must be in the same transaction.
Now, as already expected, issues with this approach pops up. Inventory system is super heavy as needs to boot a duplicate Financial Layer.
I guess introducing a Messaging Middleware like HornetQ or ActiveMq would be the best thing to do here as below.
My questions are:
- How can I achieve centralized transaction management between Financial and Inventory?
- Is there a benefit here if I use a Java EE Server like jBoss?
- If I move one of the application into another jboss instance running in another server, Can I still have centralized transactions?
来源:https://stackoverflow.com/questions/28604899/distributed-transaction-between-multiple-apps-in-spring