From users-return-8715-apmail-activemq-users-archive=activemq.apache.org@activemq.apache.org Tue Apr 24 00:04:34 2007 Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 8238 invoked from network); 24 Apr 2007 00:04:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Apr 2007 00:04:33 -0000 Received: (qmail 67891 invoked by uid 500); 24 Apr 2007 00:04:39 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 67872 invoked by uid 500); 24 Apr 2007 00:04:39 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 67863 invoked by uid 99); 24 Apr 2007 00:04:39 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2007 17:04:39 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=HTML_MESSAGE,MIME_HTML_ONLY,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [192.138.151.122] (HELO fm200.sybase.com) (192.138.151.122) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2007 17:04:31 -0700 Received: from smtp2.sybase.com (sybgate2.sybase.com [10.22.97.85]) by fm200.sybase.com with ESMTP id l3O04AO01009; Mon, 23 Apr 2007 17:04:10 -0700 (PDT) Received: from gwwest.sybase.com (localhost [127.0.0.1]) by smtp2.sybase.com with ESMTP id l3O049U15007; Mon, 23 Apr 2007 17:04:09 -0700 (PDT) Importance: Normal X-Priority: 3 (Normal) Subject: RE: XATransaction From: Christopher.Mathrusse@sybase.com To: daniel@gradecak.com, users@activemq.apache.org MIME-Version: 1.0 X-Mailer: IBM Lotus Domino Access for MS Outlook (2003) Release 6.5.4 March 27, 2005 Message-ID: Date: Mon, 23 Apr 2007 17:04:07 -0700 X-MIMETrack: Serialize by Router on gwwest/SYBASE(Release 6.5.5|November 30, 2005) at 04/23/2007 05:04:09 PM, Serialize complete at 04/23/2007 05:04:09 PM Content-Type: text/html; charset="us-ascii" X-Virus-Checked: Checked by ClamAV on apache.org
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 <daniel@gradecak.com> [mailto:Daniel Gradecak <daniel@gradecak.com>]
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