Reputation: 2500
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.
Upvotes: 0
Views: 572
Reputation: 9464
If the point of the document consumer is to just hide the API of the document service, then it is almost definitely a waste of time. If the problem is that the document service is too big, and is difficult to scale the way you need to for asynchronous document processing, that is a different problem.
I have gotten around this in the past by taking the same binary, and creating multiple interfaces to it, allow me to deploy it in "service mode" or "worker mode". In "service mode" it serves public and synchronous requests. In worker mode, a subset of the system is spun up just to service messages from a queue.
Upvotes: 1