#1 2019-01-04 02:11:45

keinn
Member
Registered: 2014-10-20
Posts: 103

How to implement a Rest Api Gateway like zuul?

We created some SOA rest servers use TSQLRestServerDB,
Like :OrderRestServer,MemberRestServer,ProductRestServer,DeliverRestServer ,etc..
Each RestServer Running in different process  deployed at different machine.

So we need to create one TSQLHttpClient for each *RestServer, so that is more then 5 TSQLHttpClient instance at client side (mobile app for example)

If app client need to get some data like: get all orders and delivery status of one member.
That's just so many calls need to made by app.

We think that is the wrong approach.

Is there a easy way to implement a Rest Api GateWay (like SpringCloud-Zuul or Kong), which combine many backend Rest Api within one http call?

Or is it the right way to do it like this: Use a dedicated Front Rest Server to provide the Aggregated Api , in this aggreated api ,we manually call all needed backend rest apis, then return the combined data to client?

(but this approach need the Front Aggregate Rest Server  to create so many httpclient instance to the backend rest server for each single client request)

Is there a better(efficient) way?(mORMot way of course)

Happy new year by the way.

Offline

#2 2019-01-04 11:13:38

ttomas
Member
Registered: 2013-03-08
Posts: 135

Re: How to implement a Rest Api Gateway like zuul?

I'm thinking about Universal Front Aggregate Rest (Interface) Server with API to register/unregister backend servers.
All backend server on start will register there API to front gateway server and unregister on end.
On API update  we will just stop backend server and start new version of backend  server and new API will be registered on gateway.
Also you can start multiple instances of backend server with same API and gateway will become proxy server.
I have a dream! Can my dream become reality?

Offline

#3 2019-01-04 12:00:28

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to implement a Rest Api Gateway like zuul?

We usually build a public API server, which calls internal MicroServices.
It is called an Application Layer in the DDD layered architecture.
See https://synopse.info/files/html/Synopse … l#TITL_155

In practice, we define a set of interfaces for those public API services, with dedicated types.
Those public API interfaces have less parameters and their methods are focused on the client-side workflows (e.g. UI screens).
Then some simple code just calls actual internal interfaces of the MicroServices, translating the types as expected.
This kind of isolation (of both types and methods) makes a little more work at first, but ease maintenance and long-term evolution a lot.

Offline

#4 2019-01-06 01:12:28

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: How to implement a Rest Api Gateway like zuul?

> We usually build a public API server, which calls internal MicroServices.
> It is called an Application Layer in the DDD layered architecture.
> See https://synopse.info/files/html/Synopse … l#TITL_155

ab, regarding DDD aproach and your samples from Ekon and SQLite3\ddd.
What is the best practice (from your experience) in organizing DDD objects/units, have one large unit defining everything like:
DomMyBigProjectTypes.pas
DomMyBigProjectInterfaces.pas
...

or splitting things into multiple units/categories like:

DomCustomerRelatedTypes.pas
DomCustomerRelatedInterfaces.pas
...
DomOrderRelatedTypes.pas
DomOrderRelatedInterfaces.pas
...
DomPricingTypes.pas
DomPricingInterfaces.pas
...

Thanks,
Igor

Offline

Board footer

Powered by FluxBB