1

Assume that I use rest call to communicate in all parts

I found that most microservice architect is like below: enter image description here

If there is a request need all of these services to compute the result. The request path like below:

client-> Account Service -> Inventory Service ->Shipping Service

The path is long and complex. If there is error occur after Account Service, I need to do compensation by Saga pattern.

I want to ask that can I add a logic unit "A" on top of those services like below: enter image description here

So that I can process all logic on this service. Those service only help the logic unit to query and phase the raw data. All complex logic do in the logic unit.

Mohsen Alyafei
  • 4,765
  • 3
  • 30
  • 42
Loui5
  • 94
  • 9

1 Answers1

0

can I add a logic unit "A" on top of those services

You can do anything you want to. Whether you should do it or not is up to you. There are no rules that state that microservices should not call each other, though popular opinion guides you to try to avoid it where possible.

The decision you are facing is what is known as the "orchestration vs choreography" trade-off. You should read up on this before making your decision.

Orchestration vs. Choreography

tom redfern
  • 30,562
  • 14
  • 91
  • 126
  • Thank you for your answering. I think this site explains Orchestration vs. Choreography very well too. – Loui5 Jul 16 '20 at 13:26