I'm currently using Bitronix Transaction Manager. (http://bitronix.be/) It is an open source transaction manager that is extremely stable. (Unlike JOTM) It implements the JTA completely and is very easy to configure and integrate with Spring. Plus you will not need to using Jenks. BTM is a complete solution.


From: Daniel Gradecak <[EMAIL PROTECTED]> [mailto:Daniel Gradecak <[EMAIL PROTECTED]>]
Sent: Monday, April 23, 2007 2:06 PM
To: users@activemq.apache.org
Subject: XATransaction

Hi,

I would like to make an ActiveMQ participate in a XA Transaction. I have
speial needs is that i may suspend a transaction and resume it in
antoher thread. I am using spring for configuring all that together
and its JmsTmplate. I saw
http://activemq.apache.org/jms-and-jdbc-operations-in-one-transaction.html
and http://jencks.org/Outbound+JMS , that seems fine to me. But I
thought I could use JTOM as TM.
So maybe it is not the right place to ask but I do not know where else :(

I would like to know if there is a better solution to use XA with
ActiveMQ because when I do a massive (never doing commit, just for test)
rollback in my "transaction resuming threads" after one hour and a half
of executing those threads (I am using Executors with a pool of 20
threads) I just receive java heap space. As I was using jencks/geronimo
I tried the same with JTOM but the same happened. I am also using the
new AMQPool from Jencks, because i do not know how else i could pool xa
connections for activemq. I also saw an old thread speaking about
http://issues.apache.org/activemq/browse/AMQ-303 but it seems it was
moved to Jencks.

So please guys, is it better to use Jencks or JTOM?

Here is my sample config ...

class="org.apache.activemq.ra.ActiveMQResourceAdapter">
name="serverUrl">${jms.brokerUrl}


class="org.jencks.factory.TransactionManagerFactoryBean">
name="defaultTransactionTimeoutSeconds">${jms.transaction.timeout}



class="org.jencks.amqpool.JcaPooledConnectionFactory">

${jms.brokerUrl}

name="maxConnections">${jms.pool.maxConnections}




name="receiveTimeout">${jms.receive.timeout}


*And the java suspend transaction code ...*

TextMessage m = (TextMessage)template.receive(queueName);
if( m != null){

tx = tm.suspend();

threadDisptacher.submit(new TxThread(tm, tx, m));

} else{
System.out.println("TIMEOUT :
"+Thread.currentThread().getId());
tm.rollback();
}

*And the TxThread when it starts it does ...*

try {
tm.resume(tx);

System.out.println("> SLEEP ...
"+Thread.currentThread().getId());
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
System.out.println("> SLEEP DONE
"+Thread.currentThread().getId());

System.out.println(m);

tm.rollback();
} catch (Throwable e) {
e.printStackTrace();
try {
tm.rollback();
} catch (Throwable e1) {
e1.printStackTrace();
}
}

Sorry for this intrusion.

Kindly,
Daniel

Reply via email to