Resource/Operational Level Timeouts

Hi Members,

We have the below request as a functionality to implement in the proxy API. Below are the usecases

1. We have API A with resource/operation R1 and R2. The API A is consumed by consumer APPs C1 and C2. We would need to set a timeout of 5 seconds between C1 and API A and timeout of 10 seconds between C2 and A. Is this possible in APIGEE ?The basepath and the resource path needs to be same for both. 

2.  We have API A with resource/operation R1 and R2. We need to have different timeouts for resource R1 and R2. Currently different resource path are built using flows in the proxy. Is this possible in APIGEE ?

3. Permuation of both 1 and 2. So basically R1 has a different timeout for APP C1 vs C2

Kind Regards

Arijit

 

0 6 217
6 REPLIES 6

There are a number of different timeouts you can configure. It sounds like you want to configure the proxy timeout - which is the timeout between the client and the proxy. As far as I know, this cannot differ per endpoint and must be set for the proxy itself. I would take the maximum time you expect for all apps and endpoints and configure it accordingly. There is also a way to configure a target timeout - which is the timeout between the proxy and the backend target. It does not sound like you are interested in that. In any case, you can find more information on the behavior of timeouts and how to configure them at https://cloud.google.com/apigee/docs/api-platform/reference/endpoint-properties-reference.

Hi @apickelsimer ,

yes my requirement is at proxy timeout where i want the timeout to be configured between proxy and the consumer apps. There can be multiple apps consuming same proxy and i want different timeout for different apps consuming same proxy ?. Also I may need to have ot at operation level. 

Is it possible in APIGEE ?

Kind Regards

Arijit

 

 

Not that I am aware, without some sort of custom policy. What's the business (not technical) case you are trying to solve?

Hi @apickelsimer 

So I have an API which depending on the query parameters it invokes multiple external calls . mash up response before sending back the response to the consumer. Now for consumer A it sends query parameters which results in only a single external call, hence processing time is less so we can configure shorter timeout compare to consumer B which sends query paramters that results in multiple external call. The processing time is long so we configure a longer timeout values. 

Note:- This is in our current API Management platform and we are looking for to like to like migration to APIGEE. 

Just a thought on 1

In the API Proxy, use a JavaScript policy to check the consumer app. You can check the consumer app by inspecting the consumer key property in the request object.

var consumerKey = context.getVariable("request.header.apikey");
if (consumerKey === "C1") {
context.setVariable("timeoutValue", "XXXX");
} else if (consumerKey === "C2") {
context.setVariable("timeoutValue", "YYYY");
}

JS code sets the timeoutValue variable to  XXXX seconds if the consumer app is C1, and sets it to YYYY seconds if the consumer app is C2.

Now we can set in Target Endpoint configuration for the API Proxy, use a variable to set the timeout value.

<HTTPTargetConnection>
<Properties>
<Property name="connectionTimeout">{timeoutValue}</Property>
<Property name="socketTimeout">{timeoutValue}</Property>
</Properties>
</HTTPTargetConnection>

This may have challenge if variable is not honored(unsure if engineering team added this feature) but plan B is as follow(not a great solution but for couple of consumers)..

We can create multiple Target Endpoints, one for each consumer app, with different timeout values. Then, you can use a JavaScript policy in your API Proxy to set the appropriate Target Endpoint based on the consumer app.

 

Hi @API-Evangelist ,

Thanks , Can this be extended to the operation/resource level for an API ?

Kind Regards

Arijit