How to compose multiple microservices with WSO2 API MicroGateway

187 Views Asked by At

The new WSO2 API MicroGateway 3.0 states as new feature Support for composing multiple microservices.I cannot find an example of how to do that. We are trying a use case with just this type of processing: An API that queries a back-end database using OData and if not found queries another (non OData) API. In both cases the result must be transformed (reformatted).

1

There are 1 best solutions below

2
Rajith Roshan On

Idea of composing microservices, is to expose set of microservices as a single API using microgateway. Basically you can define define set of REST resources and then point them to different microservices. For ex: /list . -> micro service1 /add -> micro service2. You can define per resource back ends using swagger (open API) extensions as below https://github.com/wso2/product-microgateway/blob/master/samples/per_resource_endpoint.yaml

As of now microgateway does not have out of the box capability to call subsequent endpoints based on the response from the previous endpoint. But you can transform the response using the response interceptors as explained below link https://docs.wso2.com/display/MG300/Adding+Interceptors