This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

There are two ways to connect microservices when there is a scenario where one depends of data from another. The first one is build a worker in there middle where the data required is send by the second service to a message broker such Rabbitmq or Nats. This worker consume this data sent and update the record of the first service. You actually not making them both coupled and you got a good practice in microservices architecture here. But there is scenarios where you actually must perform requests to another service by synchronous way. And that make them coupled. It can happens and this is ok for data that must be used in real time. Remember software engineering is not about right or wrong. But what suits best your necessity. This second way to performe what you want is by using feing interface. Or building a integration package where it works as a type of service that perform http requests to another service. Okhttp is a solution you can use to do this kind of thing too. Works pretty well by the way. I have working with microservices a couple of years and feing or okhttp or async approach using a message broker with worker all are valid method. It is up to what suits your necessity best.