Connection Handling in WebFlux with MongoDB Reactive on MongoDB Atlas Serverless

Hello everyone,

I am currently working on a project where I’m using Spring WebFlux and MongoDB Reactive, with MongoDB Atlas Serverless as my database. I’ve encountered an issue where my application seems to experience occasional disconnections from the MongoDB Atlas Serverless instance. My suspicion is that the server might be closing the connection after a period of inactivity.

Does anyone have experience with this kind of issue? Does MongoDB Atlas Serverless close connections after a certain idle time? And if so, what would be the best way to handle these disconnections?

I’m currently exploring the idea of implementing a reconnection logic within the application, but I’m not sure if this is the best solution. Could anyone recommend a more appropriate approach to tackle this situation or perhaps share how you’ve solved a similar issue in the past?

Any insights, suggestions, or references would be greatly appreciated. Thank you in advance!

Best regards,

Frank Lin

1 Like

Same issue, searching for a solution