Abstract
How Microgateway proxies can point to different target endpoints in different environments?
Problem
Microgateway reads proxy name, basePath and target endpoint from API Proxies hosted in Edge. When a Microgateway is configured for an environment it exposes all (default behavior) the edgemicro_* proxies deployed on that environment.
Typically, target endpoints are different for each environment. When the same proxy is deployed to different environments, the target endpoints don't change. So how do you handle this with Microgateway?
Approach
If you were only working Apigee Edge, then you can leverage target servers or route rules and even some custom JavaScript to dynamically route API requests to different backend based on the environment. Microgateway does not have access to target server info or route rules.
Option 1
One could create a proxy for each environment and deploy that proxy only to that environment. For example, edgemicro_dev_sample1 (with target endpoint to https://sample1.dev.example.com) and edgemicro_test_sample1 (with target endpoint to https://sample1.test.example.com).
With this approach, you are creating a lot of proxies and have to be careful to know which environment you want to deploy a proxy to. While I'm not a fan of this approach, it is certainly doable.
Option 2
In this approach we rely on an external service catalog that stores endpoints for each environment. One could leverage tools like Apache Consul or Netflix's Eureka for this. But in this article, I will leverage Apgiee Edge itself.
Routing Logic
Each Microgateway instance is configured to use the custom plugin. One of the configuration parameters for the plugin is to setup the endpoint lookup URL (for the Apigee Edge proxy).
Hi @Srinandan Sridhar.....thanks for this article...an informative one
Can you please.https://community.apigee.com/users/2485/ssridhar.html add a video to show how to deploy the new plugin in edgemicro