There are many situations where a particular method needs to be executed at a time by just one thread or http request.
For example it’s common that scheduled tasks in our project be executed at most once at the same time. If a task is being executed on one node, it acquires a lock that prevents execution of the that task from another thread or another node in clustering.
Another situation is when we need to lock a particular method with its input or parameters.
for example imagine we have an API that receive
foodId and do something…
Microservices architecture is very popular. But one of the main problems is how to manage distributed transactions across each microservices.
In a monolith application, transactions handle in a single database. Transactions will be initiated at the database level and will be committed or rolled back based on the flow of the transaction.
But in a microservices architecture, the monolith system decomposes into isolated services. This means a local transaction in the monolithic system is now distributed into multiple services that will be called in a sequence. [Reference]
What is the solution in a microservices system?
For example imagine we have…
What is OpenJPA?
Apache OpenJPA is a Java persistence project at The Apache Software Foundation that can be used as a stand-alone POJO persistence layer or integrated into any Java EE compliant container and many other lightweight frameworks, such as Tomcat and Spring.
What is Oracle identity column?
Oracle 12c introduced a new way that allows you to define an identity column for a table, which is similar to the
AUTO_INCREMENTcolumn in MySQL or
IDENTITYcolumn in SQL Server.
Feign is a declarative web service client. It makes writing web service clients easier. To use Feign, create an interface and annotate it. It has pluggable annotation support including Feign and JAX-RS annotations.
Spring Cloud adds support for Spring MVC annotations and for using the same
HttpMessageConverters used by default in Spring Web. Spring Cloud integrates Ribbon and Eureka to provide a load balanced HTTP client when using Feign. (https://cloud.spring.io)
Creating a Feign client in Spring cloud is simple. All you have to do is to create an interface and annotate it with @FeignClient.
Requests generated by Feign clients can…