6.4. HornetQ and Transactions

With the older JBoss Messaging technology, persistent messages were stored in a database, with several choices. The JBoss Messaging tables could be combined with all other tables into one unified data source, or separated into its own schema, catalog or database instance (whichever terminology is relevant to your particular database). If messaging schema is combined with other tables, all transactions that span both the messaging system and the application's tables would participate in the same transaction, and commit and rollback as a group. This would be true, even if you defined the data source to be an XA data source, because the XA protocol specification allows a single phase commit optimization for just this circumstance. If you kept them separate, then you would have to define your application data source and the messaging data source to both be XA data sources, so you would get the proper transaction semantics between your messages and your application. Now that HornetQ uses its own file system journal there is no way to unify the other persistent parts of the application with the journal from a transaction perspective, as was possible with JBoss Messaging. If there's a need for messaging and application persistence to participate in the same transaction, the data source must be setup as an XA data source.