0

メッセージが apigee によって受信されたらすぐにユーザーに返したい API があります。私のサービスからの応答を待たないでください。apigee api プロキシを使用してそれを行う方法を知っていますか?

4

3 に答える 3

1

httpClient get メソッドを使用して Kaszaq の最初の正しいアプローチを試みたと思います。Apigee Docs に記載されているとおりです。

http://apigee.com/docs/api-services/content/javascript-object-model

https://github.com/apigee/api-platform-samples/blob/master/sample-proxies/async-callout/apiproxy/resources/jsc/callout.js

はい、より堅牢なソリューションが必要な場合は、Node.js を試してください。

//
//  Make 5 HTTP callouts to Yahoo weather to get the weather for 5 cities 
//  The calls are all asynchronous and execute in parallel
//  httpClient returns an exchange object that will contain the HTTP response. . . when it arrives
//

var paloAlto = httpClient.get('http://weather.yahooapis.com/forecastrss?w=2467861'); 
context.session['paloAlto'] = paloAlto;

var anchorage = httpClient.get('http://weather.yahooapis.com/forecastrss?w=2354490'); 
context.session['anchorage'] = anchorage;

var honolulu = httpClient.get('http://weather.yahooapis.com/forecastrss?w=2423945');
context.session['honolulu'] = honolulu;

var newyork = httpClient.get('http://weather.yahooapis.com/forecastrss?w=2459115');
context.session['newyork'] = newyork;

var dublin = httpClient.get('http://weather.yahooapis.com/forecastrss?w=560743');
context.session['dublin'] = dublin;
于 2014-02-06T06:02:20.567 に答える
0

Node.js を使用して API を自由にカスタマイズできます。これを使用して、API プロキシに非同期動作を実装できます。

Node.js を使用した API のカスタマイズの詳細については、次のリンクにアクセスして ください - http://apigee.com/docs/api-services/content/developing-nodejs-applications-apigee-edge

于 2014-01-12T03:48:22.560 に答える