简体   繁体   English

微服务通信设计

[英]Microservices Communication Design

I would like to know how to create a communication for each services. 我想知道如何为每种服务创建通信。 I am using API Gateway for the outside of the system to communicate with the services within. 我在系统外部使用API​​ Gateway与内部的服务进行通信。 Is it necessary for a service to call another service through API Gateway or just directly into the service itself ? 服务是否需要通过API网关或直接进入服务本身来调用另一个服务?

Thank You 谢谢

You can design your communications strategies in many ways. 您可以通过多种方式设计沟通策略。 Obviously you can use your API Gateway to do this (I assume that you are using this pattern ) but this isn't a good idea because to begin it is not a good use of the pattern and for other hand many people think that the use of apirests should never be used to inter-communication of mservices. 显然,您可以使用您的API网关来执行此操作(我假设您正在使用此模式 ),但这不是一个好主意,因为开始时并不能很好地使用该模式,另一方面,许多人认为的apirest绝不能用于mservice的内部通信。 One a best approach to make this instead is base the communications on asynchronous message-passing, to do this you can use Publish–subscribe pattern , but always you can take a look to Event Pattern very used too. 最好的一种方法是使通信基于异步消息传递,要做到这一点,您可以使用“ 发布-订阅”模式 ,但始终可以看看非常常用的“ 事件模式”

This is a simple list of some articles that maybe could help you, take a look: 这是一些可能会帮助您的文章的简单列表,请看一下:

Is a lot of info if you don't have previous experience in this issues but with a bit of researching you will find soon a good strategy to use in you project. 如果您以前在此问题上没有经验,可以获取很多信息,但是通过一些研究,您很快就会发现在您的项目中可以使用的一种很好的策略。

内部服务与服务之间的通信不需要Api网关,但是,您需要服务注册表或某种动态负载平衡机制才能访问服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM