Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Data Composition / Aggregation #883

Closed
ThaDaVos opened this issue Mar 20, 2019 · 5 comments
Closed

[Question] Data Composition / Aggregation #883

ThaDaVos opened this issue Mar 20, 2019 · 5 comments

Comments

@ThaDaVos
Copy link

ThaDaVos commented Mar 20, 2019

Quick question - does Express Gateway support something called Result Aggregation or Data composition?
So for example, client makes call to gateway GET /user/{id}
Gateway calls three microservices and combines their responses as follows:
GET http://microservice1.com/accounts/{id} -> RETURNS { "id":"1", "email":"john@doe.com" }
GET http://microservice2.com/memberships/for/{id} -> RETURNS [ { *MEMBERSHIP* }, { *MEMBERSHIP* } ]
GET http://microservice3.com/avatars -> RETURNS { "avatar": "http://example.com/avatar/1" }

Gateway returns ->

{
    "id": "1",
    "email": "john@doe.com"
    "memberships": [
        { /*MEMBERSHIP*/ },
        { /*MEMBERSHIP*/ }
    ],
    "avatar": "http://example.com/avatar/1"
}

(a) Is above possible? (b) Or should I really create my own policy for this to make this work?
(c) Or is this considered bad practice?

@XVincentX
Copy link
Member

We do not support this natively in Express Gateway. Next time use Stackoverflow or Gitter :)

@ThaDaVos
Copy link
Author

@XVincentX - I did use Gitter 😂
But I thought let's also ask it here so anyone looking for it can quickly find it and know the answer

@XVincentX
Copy link
Member

XVincentX commented Mar 20, 2019 via email

@ThaDaVos
Copy link
Author

Sorry @XVincentX - It was not meant to bother you - I understand your personal time :D

@ThaDaVos
Copy link
Author

I'll try to look into this myself - maybe I can come up with an alternative policy for the proxy which allows data composition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants