1 Reply Latest reply on Dec 18, 2011 8:27 PM by gaohoward

    Resource/session re-use for message producer in MDB

    stusrob

      I want to enqueue a new message from within the run-time of an MDB that is running within a JTA transaction, without having to enlist a new resource in the transaction to do so. The scenario is reproduced by running the example mdb-tx-send from the 2.2.5 HornetQ distribution on JBoss 6.1.0.

       

      I have found a significant performance penalty in this scenario, due to the fact that the MDB resource is not shared by the connection created for the producer, resulting in a 2-phase commit where it would be otherwise avoided. Turning on trace logging for the transaction manager, the following log statements are produced:

       

      2011-12-17 13:57:50,164 TRACE [com.arjuna.ats.jta] (Thread-1 (group:HornetQ-client-global-threads-23151181)) TransactionImple.enlistResource

      ( org.hornetq.core.client.impl.DelegatingSession@250a08 )

      2011-12-17 13:57:50,398 TRACE [com.arjuna.ats.jta] (Thread-1 (group:HornetQ-client-global-threads-23151181)) TransactionImple.enlistResource

      ( org.hornetq.ra.HornetQRAXAResource@3eef33 )

       

      For comparison, if I use the DefaultMessageListenerContainer class from Spring instead, it will re-use the same resource for both producer and consumer and therefore reduce the number of round trips to the HornetQ server on the transaction commit. This configuration has other problems, however, due to constant closing and re-creation of consumers.

       

      Is there a configuration option to allow the message producer running in the MDB to re-use the consumer resource?