In the following distributed transaction scenario, a transaction spans a message queue and a database. In Java EE, application is a very common scenario. For example, an application receives a message on a queue and wants to process it. After processing, the application will save the result of the process to the database. Both the operations on the database and topic must be a part of the same distributed transaction. If the on the database fails, we would have all the transactions rolled back, the operations on the queue.
Here is an example of a distributed transaction--message queue and database:
This will be seen in detail in Chapter 8, Working with Messaging.