3

I have a client which depends on data fetching from two different domains. Client fetches the data from Domain "A"'s API layer and Domain "A"'s Data Depends on Domain "B"

There is an implementation on Domain "A" services layer to call HTTPenter image description here Request to Domain "B" s API layer.

What I feel is we should fetch data by Using HTTP calls from the API layer and we should not move it to the service layer and I see this as an anti pattern.

What should be the most acceptable way to move forward with this scenario?

4

The API layer represents the API that you offer to the client.

If the call to domain B is just the forwarding of a client request without added value, then it is indeed something that you could handle in the API layer, which acts as a facade do the client.

If the call is in fact contributing to the service you provide, some more thoughts are required:

  • I understand that you would like to see your API layer as a gateway layer, that handles all the communications with the external world à-la hexagonal architecture. You could do that, but I'd still advise to make a difference because the incoming and outgoing calls are of different nature (e.g. draw two slots in the same layer).

  • You could also consider the question more broadly above all the domains, and consider some kind of "service bus" / messaging layer that is independent of Domain A and Domain B or a general API gateway.

0

If You would like to implement the application in SOA architecture then it is better call a service from a business process it is called service orchestration. you may think of it as similar to the Controller in MVC pattern

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.