You can find a working example with Bitronix here [1].

[1] https://github.com/muellerc/camel-in-transaction

Best,
Christian

On Sat, Oct 6, 2012 at 9:19 AM, Babak Vahdat <babak.vah...@swissonline.ch>wrote:

> Hi
>
> Setting up JTA is not that easy. Have you verified that Bitronix can
> properly "talk" with your JDBC driver? Is your Database driver already
> XA-capable, that's does it provide any javax.sql.XADataSource
> implementation? If not it will not participate in a global rollback even if
> Bitronix asks it to do so.
>
> Bitronix also provides XADataSource wrappers in case you database driver is
> not XA-capable (check the Bitronix documentation for
> bitronix.tm.resource.jdbc.lrc.LrcXADataSource). Another possible option
> could be to also give Atomikos a try.
>
> Maybe you also want to check the Camel XA samples of Christian Müller:
>
>
> https://github.com/muellerc/camel-in-transaction/tree/master/src/test/java/org/apache/cmueller/camel/samples/camelone/xa
>
> Babak
>
>
> Lucas Amador wrote
> > Thanks for the point! Now the transaction manager seems to be *working*
> > but when an exception is throwed the rollback doesn't seem to be
> executed.
> >
> > well, I see the next lines in console
> >
> > org.spring.spi.TransactionErrorHandler.processInTransaction - Transaction
> > begin (0x3643b5bb) for ExchangeId: ID-lucaz-62564-1349462154706-0-1
> > Hibernate: select myCustomSequence.nextval from dual
> > Hibernate: insert into Person (id, name) values (?, ?)
> > // Exception throwed and delivery attempts
> > org.spring.spi.TransactionErrorHandler.processInTransaction - Transaction
> > rollback (0x3643b5bb) for ExchangeId: ID-lucaz-62564-1349462154706-0-1
> due
> > exception: java.lang.Exception
> >
> >
> > but the Person entity stills being persisted in the database. Am I
> missing
> > something?
> > <bean id="exception" class="java.lang.Exception" />
> >
> > <camel:onException>
> >
> > <camel:exception>
> > java.lang.Exception
> > </camel:exception>
> >
> > <camel:redeliveryPolicy maximumRedeliveries="1" />
> > </camel:onException>
> >
> > <camel:route>
> >
> > <camel:from uri="direct:jpaTransactedWithException" />
> >
> > <camel:transacted />
> >
> > <camel:to
> > uri="jpa:com.example.Person?transactionManager=#jtaTransactionManager" />
> >
> > <camel:throwException ref="exception" />
> > </camel:route>
> >
> >
> > --
> > Lucas Amador
> >
> >
> > On Friday, October 5, 2012 at 11:08 AM, Babak Vahdat wrote:
> >
> >> Hi
> >>
> >> I've updated the Wiki to be clear about this (needs couple of minutes to
> >> be
> >> synced with the website):
> >>
> >>
> http://camel.465427.n5.nabble.com/CONF-Apache-Camel-gt-JPA-td5720613.html
> >>
> >> Babak
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://camel.465427.n5.nabble.com/JPA-component-and-JTA-tp5720611p5720614.html
> >> Sent from the Camel - Users mailing list archive at Nabble.com
> >> (http://Nabble.com).
> >>
> >>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JPA-component-and-JTA-tp5720611p5720662.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Reply via email to