In our company we use spring boot, microservices, spring cloud and so on... We are happy with this infrastructure, but I still have some concerns: we use rest as comunication protocoll and even if a I find it great, I still think that we could find something better. With rest:
URI
, the http method (POST, GET, PUT,...
)Don't you think It would be much easier if we had something like RMI? I know it's a quite old technology(and it's not language independent), but it made life easier (you just need an interface and its implementation).
Searching around, I found some interesting projects like feign clients or spring cloud stream, but none of them seem to be the silver bullet.
What do you think about this topic? Is that a problem that you feel? If so, how do you approach it?
Thanks in advance.
The two commonly used protocols are HTTP request/response with resource APIs (when querying most of all), and lightweight asynchronous messaging when communicating updates across multiple microservices. These are explained in more detail in the following sections.
Using an asynchronous, microservice architecture. For most applications, the way to make microservices work and to manage distributed data successfully is to use sagas and CQRS views. In such an architecture, services communicate asynchronously using domain events, and command/reply messages.
In my company, we use JMS to add a "intern" communication stack to our microservice stack. It is reliable, simple to use, efficient and very performant.
We use Apache ActiveMQ as implementation, but RabbitMQ is also widely used.
Microservices are not meant to be tightly coupled , RMI requires your code on both end , which was fun when you didnt control the other side eg clients who do not want to upgrade and it was a B!@*! to get through firewalls.
Soap solved most of those things you mention unfortunately Java never had a good Soap stack. That said Rest has other advantages especially when accessing the service from a web page and javascript.
You can use Spring Cloud Netflix and Eureka as Service Discovery and Client-Side Load Balancing with Ribbon.
With the help of those you can communicate between microservice by 'service names' instead of service locations.
Check out this demo. It should be VERY USEFULL for undestanding microservices communications.
Here we have 2 simple microservices and Discovery Service for communications between them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With