I have a micro-service that captures callbacks from the payment gateway once the user completes the payment and stores it in the Database. Currently, if there is an issue with the database (DB down, not enough available connection ..) the method fails and the service is unable to capture the details of the payment. What are possible approaches that I may take to improve the resiliency to the service in such scenario. One possible solution might be to store the data in a queue and attempt to load the data back from the queue once the DB is back up. However, it would be helpful to have few other alternative approaches.
Resiliency against DB unavailability in SPRING-BOOT + MongoDB
34 Views Asked by ananda At
1
There are 1 best solutions below
Related Questions in MONGODB
- MongoDb not connecting C#
- How do I link two models in mongoose?
- MERN Stack App - User Avatar Upload - 500 Error After Deployment on Render
- On the server side, it returns undefined but on the client side, logs the values no problem
- Laravel: Using belongsToMany relationship with MongoDB
- What are some MERN projects that will grow me from junior dev to senior
- Save Interface in DB golang
- findOneAndUpdate not updating value in mongodb?
- Get Type Error when using .countDocuments with mongoDB
- Getting a Large Error Output When Calling MongoDB/Mongoose Functions Without an Error Message
- How to enter data in mongodb array at specific position such that if there is only 2 data in array and I want to insert at 5, then rest data is null
- using Python to insert_one to my mongo_db, How do I pass key values into a function?
- SSL Certificate Verification Error When Scraping Website and Inserting Data into MongoDB
- connect ECONNREFUSED 43.205.72.30:27017 while connecting to Atlas
- Vite is probably changing my import path. What should I do?
Related Questions in SPRING-BOOT
- Multi Tenancy in Spring - Partitioned Data Approach
- I have created a spring boot application with spring data JPA, Rest ,oracle and i am getting this ORA-00933: SQL command not properly ended
- Springboot: How to get an entity optional property and check null?
- How to create jasper report in spring boot rest api with jpa
- JSON Body is Not Passing Certain Strings
- Unresolved reference error is showing up after adding the dgs codegen plugin successfully
- Transaction silently rolled back
- JPA buddy error when generating JPA Entities from DB
- Migrating Spring Boot 2 to 3 throws org.glassfish.jaxb.runtime.v2.runtime.IllegalAnnotationsException: 3 counts of IllegalAnnotationExceptions
- Hibernate SQL Error: Missing FROM-clause entry for table "th1_1"
- Appwrite and / or Spring Boot Backend
- Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. I'm using Postgresql
- Driver com.microsoft.sqlserver.jdbc.SQLServerDriver claims to not accept jdbcUrl, ${SPRING_DATASOURCE_URL}: GitHub Actions
- springboot class org.hibernate.mapping.Bag cannot be cast to class org.hibernate.mapping.SimpleValue
- Spring security causing 404 with message "No static resource login"
Related Questions in MICROSERVICES
- HTTP Requests from SSL Secured(HTTPS) Domain Failing
- Separation of Students and Users in NestJS Microservice architecture
- How to choose port number for various microservices? whatever port number I use is already used-blocked or I'm not able to use them
- Handling feign exception in Spring boot using RestControllerAdvice
- Javers in microservice architecture
- Kafka integration between two micro service which can respond back to the same function initiated the request
- HTTP 401 unauthorized ASP.NET Core Web API microservices
- Minikube tunnel - Ingress not working on windows
- importing class in microservice 1 from another microservice 2
- Eureka Discovery client is not register under API-GATEWAY\host.docker.internal
- Unable to PUT JSON using ADF Dataflow, the error is "the JSON value could not be converted to System.Collections.Generic.List"
- Using Django as API gateway & authorizations service in Microservice
- How to fix HTTPS on express-gateway
- Websocket duplicate on headers
- migrate from django migrations to fastapi alembic
Related Questions in RESILIENCY
- Circuit Breaker not closing after opening
- API level Circuit Breaker Implementation
- Resiliency against DB unavailability in SPRING-BOOT + MongoDB
- Ensuring Sub-5 Second Failover in Highly Consistent Database Architecture on AWS
- How to use SqlRetryLogicBaseProvider to retry connections during Azure SQL scaling up/down
- python resiliency to handle slow calls to remote API
- AWS SQS and SQS DLQs are the fail safe. What if the SQS Service Fails?
- Remove SqlServerRetryingExecutionStrategy from DbContext
- Resilience4J still jumping into fall back method after switching to disabled state
- Resiliency during SaveChanges in EntityFrameworkCore
- What are the downside of having more db connections open than required?
- Implement Resiliency at protocol level
- C#: Throttle/rate limit outgoing HTTP requests with Polly
- If RPC node crashes in private Ethereum network, transactions in mempool might be lost?
- Why use AWS ELB over Route53 considering cost?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Making your microservice strong in dealing with database issues are crucial for the reliability on any payment system. we can follow below to enhance the same :
Retry System: Create a retry system for database tasks. If a task fails due to a temporary problem, like a short database issue, set your microservice to try again after a pause. Use a set timeout approach to avoid overloading the database when it's back online.
Circuit Breaker Technique: Use the Circuit Breaker approach in your microservice. It can pause database operations temporarily if it detects repeated failures. This prevents your microservice from continuously trying to write to the database during a long issue, giving the database time to recover.
Async Processing: Instead of directly adding payment details to the database, handle payment processing asynchronously. Save payment details in a message queue and then process them separately. This way, your microservice can acknowledge payments quickly without being stuck by potential database problems.
Connection Pooling: Ensure your microservice uses a database connection pool. This helps manage and reuse connections efficiently, avoiding problems with running out of available connections. Many modern database tools support connection pooling, I guess MongoDB but I am not sure.
Graceful Downgrading: Plan for a graceful way to handle issues. If the database is having problems, let your microservice offer a limited set of features, like logging payment details to a file or another storage system, without affecting the user experience.
Fallback Plan: Have a backup plan for critical operations. If the database is unreachable, temporarily store payment information in another storage and retry writing to the database when it's back.
Health Checks and Monitoring: Regularly check the health of your microservice and the database. Set up monitoring to catch problems early, so you can fix them before a major failure.
Database Copying: Think about setting up database replication with a standby or read-only copy. If the main database is down, your microservice can still read from the replica, ensuring at least read operations can continue.
Backup Systems: If possible, consider having backup databases in different places. Your microservice can switch to a secondary database if the main one is not available.
Rollback Strategy: Set up a rollback mechanism that can undo partially completed tasks if an issue happens during payment processing. This keeps things consistent and maintains data integrity.
You can finalise the strategies that fits your needs to build a strong and dependable microservice for payment processing.