Managing concurrency with Apache Cassandra
We want to enhance our comments system by adding a new feature: upvoting comments. We will add a counter to our comments showing the positive votes that have been received.
This simple requirement can be complex in a high-concurrency scenario. If multiple users are upvoting a comment, it may happen that we aren’t updating the latest version of the comment. To tackle this scenario, we will use an optimistic concurrency approach with Cassandra.
Getting ready
We will use the same tools that we did in the Connecting your application to Apache Cassandra recipe – that is, Docker and Apache Cassandra.
The starting point will be the project we created for the Using Apache Cassandra Templates recipe. If you haven’t completed it yet, don’t worry – you can use a full version of the project that I’ve prepared in this book’s GitHub repository at https://github.com/PacktPublishing/Spring-Boot...