We also have non-database XAResources. We have simply created a utility
method to enlist resources to the transaction (see below). In it's
simplest case, this method can be called from the resource constructor
(with "this" as argument). Doing so in a factory would be better.
I don't know of a more proper way to this.

  public static void attachToTransaction(XAResource xaResource) throws
Exception {
      // Enlist as resource in transaction
      TransactionManager tm = (TransactionManager)new
InitialContext().lookup("java:comp/TransactionManager");
      javax.transaction.Transaction tx = tm.getTransaction();
      if(tx != null && (tx.getStatus() == Status.STATUS_ACTIVE ||
tx.getStatus()== Status.STATUS_MARKED_ROLLBACK))
        tx.enlistResource(xaResource);
  }

 /Mattias J

David Mack wrote (2007-11-30 03:12):
> Is there a way to configure the Resin 3 transaction manager to manage 
> custom resources that implement the XAResource interface?  I currently 
> have it controlling distributed transactions for Oracle and Mysql db 
> servers and I would like to implement some interfaces to non-database 
> resources.
>
> Thanks,
>
> David


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to