-
Notifications
You must be signed in to change notification settings - Fork 0
Description
There is a lot of cross-talk between applications, using various verbs (GET, PUT, etc.) and encoding methods (JSON, multipart, etc.) - usually these rely on a ruby client of some sort for communication between servers. Usually these are written from scratch using Net::HTTP::Request - in some cases (magma) there is a gem that bundles such a client.
It's cumbersome to both write these clients from scratch for every A->B service connection; and to manage and import gems for sharing these clients.
Instead we can add client facilities to each Etna::Application. When the application boots up, an Etna::Client is initialized to talk to another Etna service. Each service publishes (at '/client') a spec for how the client should interface with it. Usually this can just be a documentation of the public api. For example, I can use /retrieve, /query, /update with magma, and from the routes in Magma::Server I can tell how to invoke this endpoint, allowing me to initialize Etna::Client.new(magma_host) and make available client.retrieve, client.update, client.query methods. These methods can use the correct verbs to communicate, etc.
This way clients can remain up-to-date with the API and servers can publish their interface to the client without a lot of cumbersome maintenance.