I am currently working on a nodeJS application that will soon need to write simultaneously on two PostgreSQL databases. This is meant for redudancy purposes: the writing operations must be made in the same time on both databases, or rollbacked if there is anything wrong with one of the databases.
In order to achieve that, I need to rely on a transaction manager that would (or at least could) use two-phase commit in the persisting process.
Currently, the application uses an out-of-the-box solution to perform actions on the current database (i.e. the pg-promise package, which for now stands as the application's transaction manager).
To put it all in a nutshell, I am going to need every persisting action in the Node application to be performed on two databases simultaneously.
For now, I merely use the pg-promise to persist data on one database like on this example:
db.one(mySQLRequest)
but I only found to create a db object for one specific database at a time.
I have found no example for such a vast problematic on a NodeJS RESTful application, but I suspect it might be a rather common issue. And I would be glad if it was not necessary that I recode the whole transaction manager on my own...
If you have any lead about how I could allow my NodeJS application to perform two-phase commits, it would be greatly appreciated. :)