I have spent days in finding a solution to a problem. I have a stateless spring boot application. take example of Payment (table) application using Spring boot. Following are the preventions and functionalities that I have to keep in mind while creating RESTApi.
Preventions
- I am not allowed to manage requests in Queue.
- Making unique keys is not an option.
Required Functionality
USE RDBMS like MySQL
App must allow simultaneous insertion. (There may be hundreds of users inserting at the same time)
There must not be duplicate records (No duplicate record for same user)
High Performance (Low response time)
I have tried other ways like multithreading or using synchronized method but this takes a lot time to process the request. I cannot keep user in waiting.
Basically I want to achieve a general solution for preventing concurrent requests at programming level.
Your Response will be highly appreciated.