Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Sharing common code between three proxies

Not applicable

I need to create three API proxies that all do essentially the same thing. There is some (non-trivial) orchestration of calls to our backend services (which will be done using nodejs) and then some translation into an output format. The only difference between the three proxies is that they will return the data in different shapes (not ideal but can't really be helped).

I want one team to own the common code and do the orchestration, and then each client team own the bit that does the translation.

The easiest way seems to be to create 4 proxies, one that does the orchestration and three others that call the first and apply the relevant translation. I know this goes against the current Apigee best practice, is there a better way?

Solved Solved
4 6 858
1 ACCEPTED SOLUTION

Not applicable

A new process that is becoming more and more popular is the use of building common fragments and policies into a common proxy and having the stitched together at build time to your other proxies using a build tool like maven. To make this easier we have a plugin that is available with ample documentation on github.com -- https://github.com/apigee/proxy-dependency-maven-plugin

The core principle is you keep a core set of policies and xml fragments (flows) in a central repository, at build time the plugin looks at the policy definitions in your flows and copies those policies into your bundle while packaging your xml, it also will look for predefined tokens in the xml wrapped in #'s if it finds those tokens it will look for a matching fragment in the common proxy structure and replace the token with the fragment of xml, this gives you the ability to have common workflows in different proxies.

View solution in original post

6 REPLIES 6