activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject RE: XATransaction
Date Tue, 24 Apr 2007 00:04:07 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii" 
format="flowed" plain; text Content-Type: 7bit Content-Transfer-Encoding:>
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=995040100-24042007><FONT face=Arial 
color=#0000ff size=2>I'm currently using Bitronix Transaction Manager. (<A 
href="http://bitronix.be/">http://bitronix.be/</A>) 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.</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Daniel Gradecak 
&lt;daniel@gradecak.com&gt; [mailto:Daniel Gradecak &lt;daniel@gradecak.com&gt;]

<BR><B>Sent:</B> Monday, April 23, 2007 2:06 PM<BR><B>To:</B>

users@activemq.apache.org<BR><B>Subject:</B> XATransaction<BR></FONT><BR></DIV>
<DIV></DIV>Hi, <BR><BR>I would like to make an ActiveMQ participate
in a XA 
Transaction. I have <BR>speial needs is that i may suspend a transaction and 
resume it in <BR>antoher thread. I am using spring for configuring all that 
together <BR>and its JmsTmplate. I saw 
<BR>http://activemq.apache.org/jms-and-jdbc-operations-in-one-transaction.html 
<BR>and http://jencks.org/Outbound+JMS , that seems fine to me. But I 
<BR>thought I could use JTOM as TM. <BR>So maybe it is not the right place to

ask but I do not know where else :( <BR><BR>I would like to know if there is a

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

<BR>class="org.apache.activemq.ra.ActiveMQResourceAdapter"&gt; <BR><property

<BR>name="serverUrl"&gt;<VALUE>${jms.brokerUrl}</VALUE></property>

<BR></BEAN><BR><BR><BEAN id=transactionManager 
<BR>class="org.jencks.factory.TransactionManagerFactoryBean"&gt; <BR><property

<BR>name="defaultTransactionTimeoutSeconds"&gt;<VALUE>${jms.transaction.timeout}</VALUE></property>

<BR></BEAN><BR><BR><BR><BEAN id=connectionFactory 
<BR>class="org.jencks.amqpool.JcaPooledConnectionFactory"&gt; 
<BR><BR><CONSTRUCTOR-ARG><VALUE>${jms.brokerUrl}</VALUE></CONSTRUCTOR-ARG>

<BR><property ref="transactionManager" 
name="transactionManager"></property><BR><property 
<BR>name="maxConnections"&gt;<VALUE>${jms.pool.maxConnections}</VALUE></property>

<BR></BEAN><BR><BR><BEAN class=org.springframework.jms.core.JmsTemplate

id=jmsTemplate><BR><property ref="connectionFactory" 
name="connectionFactory"></property><BR><property 
<BR>name="receiveTimeout"&gt;<VALUE>${jms.receive.timeout}</VALUE></property>

<BR></BEAN><BR><BR>*And the java suspend transaction code ...* 
<BR><BR>TextMessage m = (TextMessage)template.receive(queueName); <BR>if(
m != 
null){ <BR><BR>tx = tm.suspend(); <BR><BR>threadDisptacher.submit(new

TxThread(tm, tx, m)); <BR><BR>} else{ <BR>System.out.println("TIMEOUT :

<BR>"+Thread.currentThread().getId()); <BR>tm.rollback(); <BR>} <BR><BR>*And
the 
TxThread when it starts it does ...* <BR><BR>try { <BR>tm.resume(tx); 
<BR><BR>System.out.println("&gt; SLEEP ... 
<BR>"+Thread.currentThread().getId()); <BR>try { <BR>Thread.sleep(10000);
<BR>} 
catch (InterruptedException e) { <BR>} <BR>System.out.println("&gt; SLEEP
DONE 
<BR>"+Thread.currentThread().getId()); <BR><BR>System.out.println(m); 
<BR><BR>tm.rollback(); <BR>} catch (Throwable e) { <BR>e.printStackTrace();

<BR>try { <BR>tm.rollback(); <BR>} catch (Throwable e1) { 
<BR>e1.printStackTrace(); <BR>} <BR>} <BR><BR>Sorry for this
intrusion. 
<BR><BR>Kindly, <BR>Daniel <BR><BR></BODY></HTML>


Mime
View raw message