What’s the best way to map API-consumed entities in Rails so you don’t need to use clients?

Asked

Viewed 12 times

0

I currently have several systems in Rubyonrails (approximately 40), all these systems are API’s and they communicate directly (I don’t have a Gateway/Manager/ESB API).

The consumer API has the consumed API address on application.yml and the models of the consumed API are in a client of the consumed API that is imported as a dependency on Gemfile consumer API:

inserir a descrição da imagem aqui

So I have a high coupling, because for every modification or addition of a model in the consumed API I also need to change the mapping of its client and replicate this change versioning the GEM and having to change the version of Gem in the 40 applications.

I now need to implement a Gateway API to route the API’s resources and ran into a difficulty (lack of knowledge myself): How to get the PRODUCT_API for example consume the model CUSTOMER of CUSTOMER_API without having to do a JSON parse of the payload received for each template I need (in a get for example)?

For example:

PRODUCT_API flame getCustomer() for API Gateway which redirects the request to CUSTOMER_API responding JSON for API GATEWAY that returns json to PRODUCT_API that consumes the received json and parses/creates an object CUSTOMER to use the data received.

In this scenario above, I would need to map the model CUSTOMER within the PRODUCT_API which also generates a high coupling.

I don’t know if I could be clear on the question, but the idea is, I need to have a kind of VO (Virtual Object) or DTO (Data Transfer Object) of objects trafficked between the API’s, because applications today do not treat JSON directly (nor is it interesting for the organization to do this).

Anyway, my need is: I need to eliminate the Client's API’s of my architecture.

Can someone help me with that?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.