Using node.js I'd like to read a RabbitMQ queue and write the message to a MongoDB database. How do I wrap the read and the write within an ACID transaction so the whole thing either works or fails?
Mongo recommends emulate two-phase commit with the following pattern:
https://docs.mongodb.com/manual/core/write-operations-atomicity/
Also it is already implemented: