Moving api-proxy code written in trireme to microgateway

Hi All,

We have several api-proxies written with ScriptTarget of NodeJS express app running in Edge Trireme runtime. This has several limitations with trireme being older version of nodejs, inability to use latest npm modules, inability to use modern ES6 syntax.

Has anyone tried moving code running in trireme to microgateway? Is this advisable to do?

From the Microgateway overview documentation - "Edge Microgateway is not designed to work with proxies that use the ScriptTarget or HostedTargets element to point to Node.js applications as backend targets."

What should we set the target of the microgateway api-proxy in this scenario?

Current api-proxy is written with ScriptTarget of NodeJS app running in trireme. The NodeJS app makes HTTP calls using request node module to nginx internal load balancer URL.

We want to move the code running in trireme to microgateway modern nodejs app.

0 5 303
5 REPLIES 5

sidd-harth
Participant V

Micro gateway is a different concept.

You should be looking at Hosted targets. Which can accept latest npm modules, ES 6 syntax.

https://docs.apigee.com/api-platform/hosted-targets/hosted-targets-overview

We are running Apigee Edge on prem (private cloud) ver 4.18.01.00, where hosted targets is not supported.

We want to move the code running in trireme to microgateway modern nodejs app.

what does the code do? If it's simple, then you might be able to use JS callouts. if you want to move to microgateway for other reasons, then it's a re-write. Same language but different programming model.

The code in NodeJS calls Java services which return verbose XML response. The NodeJS code in trireme converts XML to JSON using xml2js node module to simplify the returned response.

Microgateway documentation use cases section does not mention "moving away from trireme" as a use-case. Can Microgateway be used to reduce the footprint of code running in trireme?

8464-edge-microgateway.png

ok it sounds like

  • the existing Nodejs code calls an external service
  • the existing nodejs code receives the reply and converts it from XML to JSON with xml2js

If I were you I would convert this to 2 policies in Apigee Edge.

  • ServiceCallout
  • XMLToJSON

If you like you could augment that with a JavaScript policy (not Nodejs!) to further filter or modify the resulting JSON. All of this will be fast and effective, and is standard straight-down-the-fairway Apigee Edge. Nothing exotic.

Altertnatively you could eliminate the ServiceCallout; simply specify the endpoint of the existing Java Service as the target of the API Proxy, and place the XMLToJSON policy in the response flow. (Followed optionally by the additional JavaScript policy).

You don't need nodejs to do the things you describe.