I'm developing a Document Management Systems (DMS) using Microservices architecture. While most services interact with each other through direct synchronous calls (Netflix Ribbon + Hystrix), there is Messaging Systems (Apache Kafka) in the middle for asynchronous document processing.
My DocumentService
, that processes documents (with using other services also) and provides public API is pretty "fat" and I can't decide is it worth to make DocumentService
consume Documents or create another microservices, that will delegate Documents to DocumentService
for further processing?
Here are diagrams of these variants:
Without pre-processing microservice
With document consuming service
From the one hand, I do not want to create too many microservices, because it's harder to control instances, but I don't want to make microservices too fat also.
P.S. Each microservices may has multiple instances.
答案 0 :(得分:1)
如果文档消费者的意思是隐藏文档服务的API,那么这几乎肯定是浪费时间。如果问题是文档服务太大,并且难以扩展您进行异步文档处理所需的方式,那就是另一个问题。
我过去通过使用相同的二进制文件并创建多个接口来解决这个问题,允许我将其部署在"服务模式"或"工人模式"。在"服务模式"它服务于公共和同步请求。在工作模式下,系统的一个子集只是为了服务来自队列的消息而旋转。