I currently work with a system of microservices communicating with gRPC. I also have MongoDB transactions implemented in many of the different backends. Now, I need to perform single write operations across two or more backends. To do this I'll need to pass the Mongo session information with gRPC. Will I have issues with this?
Matthew Cory
Tagline not found.
I can't speak to whether or not this is possible, but I do know that there's a design pattern around this, the long-running transaction or saga. One link I found to cover it: microservices.io/patterns/data/saga.html. There's a good amount of info out there for it too.
In general, regardless of whether or not you can maintain a session across services, I'd recommend against it. If something on the DB server chokes and you lose your session while the communication from the first service to the next is in flight, you'll be pretty hosed.