You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by balpeck <ba...@gmail.com> on 2007/11/11 19:08:25 UTC
Distributed Transaction using ActiveMQ/JOTM/JDBC
Hi everyone,
I am trying to get a distributed transaction going with JOTM as a
transaction manager and ActiveMQ and JDBC as participants in the distributed
transaction. I'm very new to both JOTM and ActiveMQ.
As I understand it now,
I need to create a TransactionManager, get an XAResource for ActiveMQ and my
DBMS(Postgresql), enlist them, get a USerTransaction and do a begin and an
end..
Is this roughly correct??
In am attempt of doing so.. I ran into a problem of the
connFac.createXAConnection() method not returning.It just hangs and returns
once I terminate the broker. Anything I may have missed?
import org.objectweb.jotm.Jotm;
import org.objectweb.transaction.jta.TMService;
import javax.transaction.*;
import javax.transaction.xa.*;
import org.apache.activemq.*;
public class TestXAJms
{
static String user = ActiveMQConnection.DEFAULT_USER;
static String password = ActiveMQConnection.DEFAULT_PASSWORD;
static String url = ActiveMQConnection.DEFAULT_BROKER_URL;
static public void main(String[]args)
{
try
{
/// Get the transaction Manager
Jotm jotm = new Jotm(true, false);
TransactionManager tm = jotm.getTransactionManager();
Transaction tx = tm.getTransaction();
/// Try to get to the XAResource for ActiveMQ
ActiveMQXAConnectionFactory connFac = new
ActiveMQXAConnectionFactory(user,password,url);
javax.jms.XAConnection xa_conn = connFac.createXAConnection();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
I appreciate any pointers on how to get a distributed transaction involving
ActiveMQ going.
Thanks,
Balpeck
--
View this message in context: http://www.nabble.com/Distributed-Transaction-using-ActiveMQ-JOTM-JDBC-tf4786860s2354.html#a13694083
Sent from the ActiveMQ - User mailing list archive at Nabble.com.