How to improve communication between microservices

In our company, we use spring boot, microservices, spring cloud, etc ... We are happy with this infrastructure, but I still have some problems: we use rest as a communication protocol, and even if I find it wonderful, I still think that we could find something better. With a rest:

  • you need to use client and server (restcontroller)
  • you need to know the server URI , method http ( POST, GET, PUT,... )
  • you need to know where the parameters go (body, querystring)
  • ....

Don't you think it would be much easier if we had something like RMI? I know that this is a rather old technology (and it does not depend on the language), but it made life easier (you just need an interface and its implementation).

Searching around, I found some interesting projects, such as fake clients or spring cloud stream, but none of them seem like a silver bullet.

What do you think of this topic? Is this a problem you feel? If so, how do you approach him?

Thanks in advance.

+5
source share
3 answers

At my company, we use JMS to add the trainee communication stack to our microservice stack. It is reliable, easy to use, efficient and very efficient.

We use Apache ActiveMQ as an implementation, but RabbitMQ is also widely used.

+3
source

Microservices should not be closely connected, RMI requires your code at both ends, which was fun when you did not control the other side, for example, clients who do not want to be updated, and it was B! @ *! to get through the firewalls.

Soap solved most of the things you are talking about; unfortunately, Java never had a good soap stack. At the same time, Rest has other advantages, especially when accessing the service from a web page and javascript.

+1
source

You can use Spring Cloud Netflix and Eureka as a service discovery and client-side load balancing with tape .

Using them, you can communicate between the microservice by "service names" instead of service locations.

Check this demo . It should be VERY USEFUL for communication with irreplaceable microservices.

Here we have 2 simple microservices and a discovery service for communication between them.

0
source

Source: https://habr.com/ru/post/1245688/


All Articles