What is the Apigee recommendation for one proxy endpoint call to the multiple target endpoints(Multiple Microservices) calls?

Not applicable

I have one proxy endpoint, which needs to call the multiple target endpoints(Multiple Microservices).

Could you recommend, which is the best approach for calling multiple target endpoints.


Solved Solved
0 10 489
1 ACCEPTED SOLUTION

10 REPLIES 10

@Mantesh Janagond , Would you like to call them in series one after other / in parallel async ?

Thank you @Anil Sagar. I would like to call them in series one after other and First API response passed to next API so on.

@anilsr  What if we need to call them in parallel, say we want to get responses from independent target services asynchronously?

Thank you so much @Anil Sagar,

We are planning to implement the following scenarios

Service 1 Request

-Service 2 Request

- Service 3 Request

- Service n Request


Case 1: Service 1 response data into service 2 request data and so on...

Case 2: Need only nth Service Response as the Proxy endpoint response

Case 3: Need an aggregation all services responses into Proxy endpoint response

Could you please provide the sample code for above scenarios?

@Mantesh Janagond ,

Absolutely, You can do that in Apigee in matter of minutes. See example here. https://docs.apigee.com/api-platform/samples/cookbook/using-policy-composition

You can build that using https://docs.apigee.com/api-platform/reference/policies/service-callout-policy ,

Have you tried that ? Are you stuck at any point ?

-------------------------------

Anil Sagar

5997-screen-shot-2017-11-23-at-75916-pm.png Learn Apigee Concepts in 4 Minutes HandsOn

As mentioned below by Anil you can use servicecallout but if you use proxy chaining you can utilize inbuilt caching also

@munimanjunath kalapati How can I call multiple target proxies from single proxy using proxy chaining?

I know how to call single proxy but I need to call multiple target proxies using proxy chaining.

Please use ServiceCallout policy once for aggregation use a javascript policy and aggregate your response. I made max 8 servicecallouts in a proxy without any issue working fine in prod.