Round-robin distribution of load to backends in Apigee Edge, with credentials

Not applicable

We need to call the backend service with different account/user in round robin pattern. For example, the 1st backend should be called with the 1st user credentials, for the first inbound API call, and another backend would be called with the 2nd user credentials, for the second inbound call, and so on. How can we achieve this in Apigee Edge?

1 2 308
2 REPLIES 2

I cannot think of a easy way to achieve this since you want to maintain state across multiple API calls and the Runtime component is designed to be stateless.

The following approach might work :

You can use KVM (Key value maps) to store the different user credentials. KVM policy you can find here and the APIs here.

Then you can have a node.js code which has the logic of all the different backend systems. The node code will look up to the KVM and find out credentials before making the call.

In the KVM you will also need to add another map which acts like a counter/array storing which credentials were last used. And the node.js code will read that and will find out which credential was last used and which one should be used next.

If you do not want to use node , you can implement similar logic using js/python/java and then in that script you can create the corresponding authentication header.

Not applicable

You could also use the secure vault with a little additional work to store and retrieve the credentials. We don't provide policies to access the secure vault like we do with KVM, but you can access the secure vault with node.js

http://apigee.com/docs/api-services/content/using-secure-store