So the question here really isn't related to HornetQ. The question is how JBoss Messaging, acting as a JTA resource manager, behaves when a transaction manager prepares a transaction involving one of its resources. Specifically, if JBoss Messaging will ever terminate the in-doubt transaction on its own (e.g. via a time-out).
To my knowledge, the answer to that question is, "no." The messages added to or removed from the destination will simply stay in the prepared stage. The in-doubt transaction will not be rolled-back or committed automatically by the resource manager (i.e. JBoss Messaging). Ideally you would have recovery configured in the AS instance which was managing the transaction so all this would be resolved without manual intervention. However, if that isn't configured correctly then the jboss.messaging:service=ServerPeer MBean has several operations you can use to resolve the transaction as far as JBoss Messaging is concerned from the JMX Console:
- showPreparedTransactionsAsHTML
- commitPreparedTransaction
- rollbackPreparedTransaction
There is no way to configure JBoss Messaging to terminate the transaction itself.
Note: Even if you resolve the transaction in the resource manager, the transaction manager will still have the in-doubt transaction in its log and it will still complain periodically that it can't recover it.