How to set up Spring Boot + Bitronix + non-XA Datasource + XA JMS Connection
Asked Answered
W

1

1

I'm trying to set-up Bitronix in Spring Boot to use last resource gambit with non-XA datasource. Of course by default (autoconfiguration) data source does not participate in XA transaction. It seems that org.springframework.boot.jta.XADataSourceWrapper will work only for XADataSource.

How to connect DataSource with Bitronix?

Woollen answered 22/1, 2016 at 15:11 Comment(0)
P
2

Bitronix uses its LrcXADataSource to implement the last resource gambit. You need to tell Spring Boot to create an XAResource of that type:

spring.datasource.xa.data-source-class-name=bitronix.tm.resource.jdbc.lrc.LrcXADataSource

You'll also need to set some other properties that will depend on the database you're using and how it's configured. For example, the name of the JDBC driver class:

spring.datasource.xa.properties.driver-class-name=org.hsqldb.jdbcDriver
Pankhurst answered 22/1, 2016 at 16:3 Comment(4)
And then org.springframework.boot.jta.XADataSourceWrapper will wrap it up with Bitronix's connection pool org.springframework.boot.jta.bitronix.PoolingDataSourceBean, right?Woollen
But what happens if I have 2 Non-XA Datasources?Andresandresen
@ElLordCode The last resource gambit only works with a single non-XA DataSourcePankhurst
Is there any solution if need more than one Non-XA Datasources in my Bitronix server?Andresandresen

© 2022 - 2024 — McMap. All rights reserved.