Database Concurrency Handling
This section explains the Database Concurrency Handling functionality, which helps you to maintain data consistency in the database and update the data properly across all platforms and engines. This capability is useful when two threads try to access a same record from the database, framework throws a concurrent modification exception in both api and ingester components, whereas in api will abort the transaction and throw the response back to the end-user, while in ingester it will re-try for three times and add the message to the error-topic.
This feature describes handling the concurrency control problem in database, basically concurrency problem occurs when two or more threads access a same record, the database throws concurrency exception, So the application must be intelligent enough to catch the exception and process it. There are two components in the microservice:
- API - When concurrency problem occurs, the exception goes back to the user with response stating the concurrency problem has occurred.
- Ingester - When concurrency problem occurs, the ingester catches the exception and retry the record for three times to try for successful ingestion, even if after three retries, data is not ingested, you should add that particular event to the error-stream, such that there is no message loss.
In this topic