OK, I see. So you are using PG and MongoDB and Ahtena in one service, but I
think only PG supports the XA transaction currently.

And yeah, Quarkus JTA transaction manager only supports using one non-XA
datasource in a XA transaction.
PG + MongoDB is OK
PG + Athena is OK
PG + MongoDB + Athena is not recommended because there are some risks to
lost the data consistent

Anyway, unsafe-multiple-last-resources can make it working but you will
face the risks. So the answer to your question is "No, it is not possible".

I don't know any business about your REST services, not sure if they really
need the strong ACID transaction. Or maybe you can consider LRA (Long
Running Activities) which is guaranteed to eventually  consistent. See
https://quarkus.io/blog/using-lra/




On Wed, Nov 20, 2024 at 8:30 AM David Hoffer <dhoff...@gmail.com> wrote:

> Hi,
>
> Yes we actually have 4 datasources.
>
> This is the main one, always exists.
>
> db-kind: postgresql
>
> emrDS:
>   db-kind: other
>   jdbc:
>     driver: com.facebook.presto.jdbc.PrestoDriver
>
> dialect: Derby
>
> athenaDS:
>   db-kind: other
>   jdbc:
>     driver: cdata.jdbc.amazonathena.AmazonAthenaDriver
>
> dialect: PostgreSQL
>
> EMR is used on some networks and Athena on others. We are trying to
> replace EMR with Athena everywhere once it's available.
>
> We also use MongoDB.
>
> Yes our apps are Quarkus and we are upgrading to the latest 3.16.x version.
>
> So we use these 3 dependencies for JPA & JTA.
>
> <dependency>
>     <groupId>io.quarkus</groupId>
>     <artifactId>quarkus-hibernate-orm</artifactId>
> </dependency>
> <dependency>
>     <groupId>io.quarkus</groupId>
>     <artifactId>quarkus-narayana-jta</artifactId>
> </dependency>
> <dependency>
>     <groupId>io.quarkus</groupId>
>     <artifactId>quarkus-agroal</artifactId>
> </dependency>
>
> <dependency>
>     <groupId>io.quarkus</groupId>
>     <artifactId>quarkus-jdbc-postgresql</artifactId>
> </dependency>
>
> <dependency>
>     <groupId>org.mongodb</groupId>
>     <artifactId>mongodb-driver-sync</artifactId>
> </dependency>
>
> Our app is a large JAX-RS application using the above DBs.  Some of
> the operations require usage of two of the JDBC DBs above.
>
> Plus some use MongoDB.  So could be 3 DBs.  (We never use EMR & Athena
> at the same time.)
>
> We would like each REST service to use XA for any DB that uses any of
> the DBs above.  It works fine for Postgres & MongoDB but latest
> version of
>
> Quarkus gives errors when Athena is used as it's not XA.  We found
> that adding: unsafe-multiple-last-resources: allow to the
> transaction-manager
>
> works but it's deprecated and warns it may/will be removed in the future.
>
>
> Is this possible for all to be XA?
>
> Thanks,
>
> -David
>
>
> On Tue, Nov 19, 2024 at 4:53 PM Zheng Feng <zf...@redhat.com> wrote:
>
> > Hi David,
> >
> > Can you describe more about your scenario? Do you want to run Athean and
> > other data sources in an XA transaction? What transaction manager did you
> > use, is it quarkus-narayana-jta?
> >
> > On Wed, Nov 20, 2024 at 7:19 AM David Hoffer <dhoff...@gmail.com> wrote:
> >
> > > https://camel.apache.org/components/4.8.x/aws2-athena-component.html
> > >
> > > We use multiple data sources in our Quarkus application and Athena is
> one
> > > of them.  Is there a way to make this XA compliant?  The latest Quarkus
> > is
> > > failing with our current CData driver as its not XA, so looking for
> > > something that is XA.
> > >
> > > Thanks,
> > > -David
> > >
> >
>

Reply via email to